Skip to content

Commit

Permalink
Merge pull request #8 from janvernieuwe/v4
Browse files Browse the repository at this point in the history
JikanPHP for V4
  • Loading branch information
janvernieuwe authored Sep 17, 2022
2 parents d087e31 + 8ed230c commit 59da2a8
Show file tree
Hide file tree
Showing 920 changed files with 65,538 additions and 13,519 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
composer.lock
vendor
.idea
.idea
/.php-cs-fixer.cache
/.phpunit.result.cache
88 changes: 88 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php
/**
* @deprecated use .php-cs-fixer.dist.php
*/
return (new PhpCsFixer\Config())
->setFinder(
(new PhpCsFixer\Finder())
->in([
getcwd().'/src',
getcwd().'/tests',
])
->exclude([
'var',
'migrations/*',
])
)
->setRiskyAllowed(true)
->setRules([
'@PSR12' => true,
'@Symfony' => true,
'align_multiline_comment' => true,
'array_indentation' => true,
'blank_line_after_opening_tag' => false,
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'comment_to_phpdoc' => true,
'date_time_immutable' => true,
'declare_strict_types' => true,
'doctrine_annotation_array_assignment' => true,
'doctrine_annotation_braces' => true,
'doctrine_annotation_indentation' => true,
'doctrine_annotation_spaces' => true,
'escape_implicit_backslashes' => true,
'explicit_indirect_variable' => true,
'explicit_string_variable' => true,
'final_internal_class' => false,
'general_phpdoc_annotation_remove' => false,
'header_comment' => false,
'heredoc_to_nowdoc' => false,
'linebreak_after_opening_tag' => false,
'list_syntax' => ['syntax' => 'short'],
'mb_str_functions' => true,
'method_chaining_indentation' => true,
'multiline_comment_opening_closing' => true,
'multiline_whitespace_before_semicolons' => true,
'native_function_invocation' => false,
'no_alias_functions' => true,
'no_blank_lines_before_namespace' => false,
'no_extra_blank_lines' => true,
'no_null_property_initialization' => true,
'no_php4_constructor' => true,
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => false,
'no_unreachable_default_argument_value' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'not_operator_with_space' => false,
'not_operator_with_successor_space' => false,
'ordered_class_elements' => false,
'php_unit_dedicate_assert' => false,
'php_unit_expectation' => false,
'php_unit_method_casing' => ['case' =>'snake_case'],
'php_unit_mock' => false,
'php_unit_namespaced' => false,
'php_unit_no_expectation_annotation' => false,
'php_unit_set_up_tear_down_visibility' => true,
'php_unit_strict' => false,
'php_unit_test_annotation' => false,
'php_unit_test_class_requires_covers' => false,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_order' => true,
'phpdoc_order_by_value' => true,
'phpdoc_to_return_type' => false,
'phpdoc_to_comment' => false,
'phpdoc_types_order' => false,
'pow_to_exponentiation' => true,
'psr_autoloading' => true,
'random_api_migration' => false,
'simplified_null_return' => false,
'single_line_throw' => false,
'static_lambda' => false,
'strict_comparison' => true,
'strict_param' => true,
'string_line_ending' => true,
'ternary_to_null_coalescing' => true,
'void_return' => true,
])
;
27 changes: 10 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,23 @@ composer require jikan/jikan-php

# Getting Started

## Instantiate the client

```php
$jikan = new \Jikan\JikanPHP\JikanPHPClient();
## Require your client implementation
For example
```sh
composer require php-http/guzzle7-adapter
```

## Use it to request MAL data
## Instantiate the client

```php
$request = new \JikanPHP\Request\Anime\AnimeRequest(1);
$anime = $jikan->getAnime($request);
$jikan = Client::create();
```

All responses are converted to PHP classes.

# Customize guzzle

## Use it to request MAL data
Check the client for the correct type hint
```php
$guzzle = new GuzzleHttp\Client();
// Add middlewares to the client, or configs
$jikan = new \Jikan\JikanPHP\JikanPHPClient($guzzle);
// The configured client is now used internally
/** @var AnimeIdGetResponse200 $anime */
$anime = $jikan->getAnimeById(5114);
```

Using the client should be self-explanatory since it is fully type-hinted.

If you experience any issues, open an issue, or even better a Pull Request!
36 changes: 9 additions & 27 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,22 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": "^7.2|^8",
"doctrine/annotations": "~1",
"guzzlehttp/guzzle": "^6.3",
"jms/serializer": "^1.13|^2.0",
"symfony/yaml": "~2.1|^3.0|^4.0",
"ext-json": "*"
"php": "^8",
"ext-json": "*",
"jane-php/open-api-runtime": "^7.3"
},
"require-dev": {
"composer/composer": "^1.8",
"funkyproject/reflection-file": "^0.1.0",
"jakub-onderka/php-parallel-lint": "^1.0",
"jikan/jikanphp-fixtures": "dev-master",
"php-vcr/php-vcr": "~1.3.2",
"php-vcr/phpunit-testlistener-vcr": "^3.0",
"phpro/grumphp": "^0.14.3",
"phpunit/phpunit": "^6.3",
"squizlabs/php_codesniffer": "^3.4",
"symfony/console": "^4.2",
"symfony/finder": "^4.2",
"symfony/var-dumper": "^4.2"
"friendsofphp/php-cs-fixer": "^3.11",
"jane-php/open-api-3": "^7.3",
"php-http/guzzle7-adapter": "^1.0",
"phpro/grumphp": "^1.13",
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.7"
},
"autoload": {
"psr-4": {
"Jikan\\JikanPHP\\": [
"src"
],
"JikanPHP\\Model\\": [
"model"
],
"JikanPHP\\Request\\": [
"request"
],
"JikanPHP\\Helper\\": [
"helper"
]
}
},
Expand Down
Loading

0 comments on commit 59da2a8

Please sign in to comment.