v4 base: upgrade to lumen 7.x & jikan parser v3

This commit is contained in:
Irfan 2020-04-25 10:38:03 +05:00
parent 5d0334168d
commit cf4f489833
6 changed files with 1332 additions and 1025 deletions

View File

@ -3,7 +3,6 @@
namespace App\Exceptions;
use App\Http\HttpHelper;
use Bugsnag\BugsnagLaravel\Facades\Bugsnag;
use Exception;
use GuzzleHttp\Exception\ClientException;
use Illuminate\Auth\Access\AuthorizationException;
@ -38,22 +37,20 @@ class Handler extends ExceptionHandler
];
/**
* @param Exception $e
* @param \Throwable $e
* @throws Exception
*/
public function report(Exception $e)
public function report(\Throwable $e)
{
parent::report($e);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @return \Illuminate\Http\Response
* @param Request $request
* @param \Throwable $e
* @return \Illuminate\Http\JsonResponse|\Symfony\Component\HttpFoundation\Response
*/
public function render($request, Exception $e)
public function render($request, \Throwable $e)
{
$githubReport = GithubReport::make($e, $request);
@ -158,6 +155,10 @@ class Handler extends ExceptionHandler
}
}
/**
* @param Request $request
* @param BadResponseException $e
*/
private function set404Cache(Request $request, BadResponseException $e)
{
$fingerprint = "request:404:".sha1(env('APP_URL') . $request->getRequestUri());

View File

@ -13,7 +13,6 @@ require_once __DIR__.'/../vendor/autoload.php';
*/
defined('BLACKLIST_PATH') or define('BLACKLIST_PATH', __DIR__.'/../storage/app/blacklist.json');
defined('JIKAN_PARSER_VERSION') or define('JIKAN_PARSER_VERSION', Versions::getVersion('jikan-me/jikan'));
defined('JIKAN_REST_API_VERSION') or define('JIKAN_REST_API_VERSION', '3.4');
/*
@ -129,7 +128,7 @@ $commonMiddleware = [
'throttle'
];
/*$app->router->group(
$app->router->group(
[
'prefix' => 'v4',
'namespace' => 'App\Http\Controllers\V4',
@ -138,7 +137,7 @@ $commonMiddleware = [
function ($router) {
require __DIR__.'/../routes/web.v4.php';
}
);*/
);
$app->router->group(
[
@ -160,16 +159,16 @@ $app->router->group(
function ($router) {
$router->get('/', function () {
return response()->json([
'NOTICE' => 'Append an API version for API requests. Please check the documentation for the latest and supported versions.',
'Author' => '@irfanDahir',
'Discord' => 'https://discord.gg/4tvCr36',
'Version' => '3.4',
'JikanPHP' => JIKAN_PARSER_VERSION,
'Website' => 'https://jikan.moe',
'Docs' => 'https://jikan.docs.apiary.io',
'GitHub' => 'https://github.com/jikan-me/jikan',
'PRODUCTION_API_URL' => 'https://api.jikan.moe/v3/',
'STATUS_URL' => 'https://status.jikan.moe'
'author_url' => 'http://irfan.dahir.co',
'discord_url' => 'https://discord.gg/4tvCr36',
'version' => '4.0',
'parser_version' => JIKAN_PARSER_VERSION,
'website_url' => 'https://jikan.moe',
'documentation_url' => 'https://jikan.docs.apiary.io',
'github_url' => 'https://github.com/jikan-me/jikan-me',
'parser_github_url' => 'https://github.com/jikan-me/jikan',
'production_api_url' => 'https://api.jikan.moe/v4/',
'status_url' => 'https://status.jikan.moe'
]);
});
}

View File

@ -5,28 +5,32 @@
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.1",
"laravel/lumen-framework": "5.8.*",
"vlucas/phpdotenv": "^3.3",
"php": "^7.2.5",
"laravel/lumen-framework": "^7.0",
"vlucas/phpdotenv": "^4",
"danielmewes/php-rql": "dev-master",
"illuminate/redis": "^5.5",
"illuminate/redis": "^7",
"predis/predis": "^1.1",
"voku/anti-xss": "^4.0",
"divineomega/cachetphp": "^0.2.0",
"jms/serializer": "^1.13",
"symfony/yaml": "^4.1",
"fabpot/goutte": "3.2.3",
"jikan-me/jikan": "^2.0",
"jikan-me/jikan": "^3.0",
"ext-json": "*",
"ocramius/package-versions": "^1.4",
"flipbox/lumen-generator": "^5.6"
"flipbox/lumen-generator": "^6"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"phpunit/phpunit": "~7.0",
"mockery/mockery": "~0.9"
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"phpunit/phpunit": "^8.5"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
@ -48,6 +52,8 @@
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}

2268
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@ $router->get('/', function () use ($router) {
return response()->json([
'Author' => '@irfanDahir',
'Discord' => 'https://discord.gg/4tvCr36',
'Version' => JIKAN_REST_API_VERSION,
'Version' => '3.4',
'JikanPHP' => JIKAN_PARSER_VERSION,
'Website' => 'https://jikan.moe',
'Docs' => 'https://jikan.docs.apiary.io',

View File

@ -3,15 +3,16 @@
$router->get('/', function () use ($router) {
return response()->json([
'Author' => '@irfanDahir',
'Discord' => 'https://discord.gg/4tvCr36',
'Version' => '4.0',
'JikanPHP' => JIKAN_PARSER_VERSION,
'Website' => 'https://jikan.moe',
'Docs' => 'https://jikan.docs.apiary.io',
'GitHub' => 'https://github.com/jikan-me/jikan',
'PRODUCTION_API_URL' => 'https://api.jikan.moe/v4/',
'STATUS_URL' => 'https://status.jikan.moe'
'author_url' => 'http://irfan.dahir.co',
'discord_url' => 'https://discord.gg/4tvCr36',
'version' => '4.0',
'parser_version' => JIKAN_PARSER_VERSION,
'website_url' => 'https://jikan.moe',
'documentation_url' => 'https://jikan.docs.apiary.io',
'github_url' => 'https://github.com/jikan-me/jikan-me',
'parser_github_url' => 'https://github.com/jikan-me/jikan',
'production_api_url' => 'https://api.jikan.moe/v4/',
'status_url' => 'https://status.jikan.moe'
]);
});