diff --git a/.env.dist b/.env.dist index 6ceeece..d8fb7be 100755 --- a/.env.dist +++ b/.env.dist @@ -7,6 +7,13 @@ APP_URL=http://localhost CACHE_DRIVER=file QUEUE_CONNECTION=redis +DB_CONNECTION=mongodb +DB_HOST=localhost +DB_PORT=27017 +DB_DATABASE=jikan +DB_USERNAME=admin +DB_PASSWORD= + CACHE_METHOD=legacy CACHE_DEFAULT_EXPIRE=86400 CACHE_META_EXPIRE=300 diff --git a/bootstrap/app.php b/bootstrap/app.php index 61a1adb..d8dec19 100755 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -13,7 +13,7 @@ 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'); +defined('JIKAN_REST_API_VERSION') or define('JIKAN_REST_API_VERSION', '4'); /* @@ -32,6 +32,7 @@ $app = new Laravel\Lumen\Application( realpath(__DIR__.'/../') ); +$app->register(Jenssegers\Mongodb\MongodbServiceProvider::class); $app->withFacades(); $app->withEloquent(); diff --git a/composer.json b/composer.json index a1e7de2..4483a8a 100755 --- a/composer.json +++ b/composer.json @@ -19,7 +19,8 @@ "jikan-me/jikan": "^2.8", "ext-json": "*", "ocramius/package-versions": "^1.4", - "flipbox/lumen-generator": "^5.6" + "flipbox/lumen-generator": "^5.6", + "jenssegers/mongodb": "^3.6" }, "require-dev": { "fzaninotto/faker": "~1.4", diff --git a/composer.lock b/composer.lock index b19a596..4739177 100755 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "46819033c448889c5250315fb1a4040e", + "content-hash": "01bbeb0bbea7d761a57e6c5a0b5ec562", "packages": [ { "name": "classpreloader/classpreloader", @@ -2099,6 +2099,75 @@ "description": "Highlight PHP code in terminal", "time": "2018-09-29T18:48:56+00:00" }, + { + "name": "jenssegers/mongodb", + "version": "v3.6.1", + "source": { + "type": "git", + "url": "https://github.com/jenssegers/laravel-mongodb.git", + "reference": "a8918acadb79f4f90d42eaddf0e996054ddd8184" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jenssegers/laravel-mongodb/zipball/a8918acadb79f4f90d42eaddf0e996054ddd8184", + "reference": "a8918acadb79f4f90d42eaddf0e996054ddd8184", + "shasum": "" + }, + "require": { + "illuminate/container": "^5.8|^6.0", + "illuminate/database": "^5.8|^6.0", + "illuminate/events": "^5.8|^6.0", + "illuminate/support": "^5.8|^6.0", + "mongodb/mongodb": "^1.4" + }, + "require-dev": { + "doctrine/dbal": "^2.5", + "mockery/mockery": "^1.0", + "orchestra/testbench": "^3.1|^4.0", + "phpunit/phpunit": "^6.0|^7.0|^8.0", + "satooshi/php-coveralls": "^2.0" + }, + "suggest": { + "jenssegers/mongodb-sentry": "Add Sentry support to Laravel-MongoDB", + "jenssegers/mongodb-session": "Add MongoDB session support to Laravel-MongoDB" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Jenssegers\\Mongodb\\MongodbServiceProvider", + "Jenssegers\\Mongodb\\MongodbQueueServiceProvider" + ] + } + }, + "autoload": { + "psr-0": { + "Jenssegers\\Mongodb": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jens Segers", + "homepage": "https://jenssegers.com" + } + ], + "description": "A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)", + "homepage": "https://github.com/jenssegers/laravel-mongodb", + "keywords": [ + "database", + "eloquent", + "laravel", + "model", + "moloquent", + "mongo", + "mongodb" + ], + "time": "2019-10-31T13:55:43+00:00" + }, { "name": "jikan-me/jikan", "version": "v2.9.0", @@ -2407,6 +2476,74 @@ ], "time": "2019-08-28T21:21:05+00:00" }, + { + "name": "mongodb/mongodb", + "version": "1.5.1", + "source": { + "type": "git", + "url": "https://github.com/mongodb/mongo-php-library.git", + "reference": "32cfb9bbd0bc60a5a13ca9eab7e4803226a5d4a7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/32cfb9bbd0bc60a5a13ca9eab7e4803226a5d4a7", + "reference": "32cfb9bbd0bc60a5a13ca9eab7e4803226a5d4a7", + "shasum": "" + }, + "require": { + "ext-hash": "*", + "ext-json": "*", + "ext-mongodb": "^1.6", + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7.27 || ^6.4 || ^8.3", + "sebastian/comparator": "^1.0 || ^2.0 || ^3.0", + "squizlabs/php_codesniffer": "^3.4", + "symfony/phpunit-bridge": "^4.4@dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5.x-dev" + } + }, + "autoload": { + "psr-4": { + "MongoDB\\": "src/" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Andreas Braun", + "email": "andreas.braun@mongodb.com" + }, + { + "name": "Jeremy Mikola", + "email": "jmikola@gmail.com" + }, + { + "name": "Katherine Walker", + "email": "katherine.walker@mongodb.com" + } + ], + "description": "MongoDB driver library", + "homepage": "https://jira.mongodb.org/browse/PHPLIB", + "keywords": [ + "database", + "driver", + "mongodb", + "persistence" + ], + "time": "2019-10-09T14:34:41+00:00" + }, { "name": "monolog/monolog", "version": "1.25.1", diff --git a/config/database.php b/config/database.php index ed6bf12..e3543af 100755 --- a/config/database.php +++ b/config/database.php @@ -1,6 +1,25 @@ 'mongodb', + 'connections' => [ + 'mongodb' => [ + 'driver' => 'mongodb', + 'host' => env('DB_HOST', 'localhost'), + 'port' => env('DB_PORT', 27017), + 'database' => env('DB_DATABASE'), + 'username' => env('DB_USERNAME'), + 'password' => env('DB_PASSWORD'), + 'options' => [ + 'database' => 'admin' // sets the authentication database required by mongo 3 + ] + ], + ], + 'migrations' => 'migrations', + 'redis' => [ 'client' => 'predis', 'default' => [