From 9dfae2a347f67ccb0310c57ed67a6d8ef1e9d6b4 Mon Sep 17 00:00:00 2001 From: Charalampos Raftopoulos Date: Mon, 9 Apr 2018 23:18:07 +0300 Subject: [PATCH 1/2] upgrade to Laravel v5.6 --- .env.example | 5 ++ .../Controllers/Auth/RegisterController.php | 5 +- app/Http/Kernel.php | 2 + app/Http/Middleware/TrustProxies.php | 23 ++++++ composer.json | 29 +++---- config/app.php | 17 ---- config/filesystems.php | 3 +- config/hashing.php | 52 ++++++++++++ config/logging.php | 81 +++++++++++++++++++ config/queue.php | 1 + config/services.php | 2 +- package.json | 30 +++---- phpunit.xml | 1 + resources/lang/en/validation.php | 1 + tests/CreatesApplication.php | 3 + 15 files changed, 205 insertions(+), 50 deletions(-) create mode 100644 app/Http/Middleware/TrustProxies.php create mode 100644 config/hashing.php create mode 100644 config/logging.php diff --git a/.env.example b/.env.example index 251aeb9..715bc44 100644 --- a/.env.example +++ b/.env.example @@ -4,6 +4,8 @@ APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=http://localhost +LOG_CHANNEL=stack + DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 @@ -30,3 +32,6 @@ MAIL_ENCRYPTION=null PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= + +MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" +MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index decab2a..e683ad8 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -2,8 +2,9 @@ namespace Framework\Http\Controllers\Auth; -use Framework\User; use Validator; +use Framework\User; +use Illuminate\Support\Facades\Hash; use Framework\Http\Controllers\Controller; use Illuminate\Foundation\Auth\RegistersUsers; @@ -65,7 +66,7 @@ protected function create(array $data) return User::create([ 'name' => $data['name'], 'email' => $data['email'], - 'password' => bcrypt($data['password']), + 'password' => Hash::make($data['password']), ]); } } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 86f26ac..16a0f65 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -53,8 +53,10 @@ class Kernel extends HttpKernel 'auth' => \Illuminate\Auth\Middleware\Authenticate::class, 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, + 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 'can' => \Illuminate\Auth\Middleware\Authorize::class, 'guest' => \Framework\Http\Middleware\RedirectIfAuthenticated::class, + 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, ]; } diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php new file mode 100644 index 0000000..00d0b28 --- /dev/null +++ b/app/Http/Middleware/TrustProxies.php @@ -0,0 +1,23 @@ +=7.0.0", - "laravel/framework": "5.5.*", - "lucid-arch/laravel-foundation": "5.5.*", - "laravel/tinker": "~1.0" + "php": ">=7.1.3", + "laravel/framework": "5.6.*", + "lucid-arch/laravel-foundation": "5.6.*", + "laravel/tinker": "^1.0", + "fideloper/proxy": "~4.0" }, "require-dev": { - "fzaninotto/faker": "~1.4", - "mockery/mockery": "0.9.*", - "phpunit/phpunit": "~6.0", - "symfony/css-selector": "3.1.*", - "symfony/dom-crawler": "3.1.*", - "lucid-arch/laravel-console": "5.5.*" + "fzaninotto/faker": "^1.4", + "mockery/mockery": "^1.0", + "nunomaduro/collision": "^2.0", + "phpunit/phpunit": "~7.0", + "symfony/css-selector": "~4.0", + "symfony/dom-crawler": "~4.0", + "lucid-arch/laravel-console": "5.6.*", + "filp/whoops": "^2.0" }, "autoload": { "classmap": [ @@ -36,12 +39,10 @@ "php artisan key:generate" ], "post-install-cmd": [ - "Illuminate\\Foundation\\ComposerScripts::postInstall", - "php artisan optimize" + "Illuminate\\Foundation\\ComposerScripts::postInstall" ], "post-update-cmd": [ - "Illuminate\\Foundation\\ComposerScripts::postUpdate", - "php artisan optimize" + "Illuminate\\Foundation\\ComposerScripts::postUpdate" ], "post-autoload-dump": [ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", diff --git a/config/app.php b/config/app.php index 30fcaa2..ab17e0f 100644 --- a/config/app.php +++ b/config/app.php @@ -107,23 +107,6 @@ 'cipher' => 'AES-256-CBC', - /* - |-------------------------------------------------------------------------- - | Logging Configuration - |-------------------------------------------------------------------------- - | - | Here you may configure the log settings for your application. Out of - | the box, Laravel uses the Monolog PHP logging library. This gives - | you a variety of powerful log handlers / formatters to utilize. - | - | Available Settings: "single", "daily", "syslog", "errorlog" - | - */ - - 'log' => env('APP_LOG', 'single'), - - 'log_level' => env('APP_LOG_LEVEL', 'debug'), - /* |-------------------------------------------------------------------------- | Autoloaded Service Providers diff --git a/config/filesystems.php b/config/filesystems.php index f59cf9e..a1fa734 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -37,7 +37,7 @@ | may even configure multiple disks of the same driver. Defaults have | been setup for each driver as an example of the required options. | - | Supported Drivers: "local", "ftp", "s3", "rackspace" + | Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace" | */ @@ -61,6 +61,7 @@ 'secret' => env('AWS_SECRET'), 'region' => env('AWS_REGION'), 'bucket' => env('AWS_BUCKET'), + 'url' => env('AWS_URL'), ], ], diff --git a/config/hashing.php b/config/hashing.php new file mode 100644 index 0000000..f3332ed --- /dev/null +++ b/config/hashing.php @@ -0,0 +1,52 @@ + 'bcrypt', + + /* + |-------------------------------------------------------------------------- + | Bcrypt Options + |-------------------------------------------------------------------------- + | + | Here you may specify the configuration options that should be used when + | passwords are hashed using the Bcrypt algorithm. This will allow you + | to control the amount of time it takes to hash the given password. + | + */ + + 'bcrypt' => [ + 'rounds' => 10, + ], + + /* + |-------------------------------------------------------------------------- + | Argon Options + |-------------------------------------------------------------------------- + | + | Here you may specify the configuration options that should be used when + | passwords are hashed using the Argon algorithm. These will allow you + | to control the amount of time it takes to hash the given password. + | + */ + + 'argon' => [ + 'memory' => 1024, + 'threads' => 2, + 'time' => 2, + ], + +]; diff --git a/config/logging.php b/config/logging.php new file mode 100644 index 0000000..400bc7f --- /dev/null +++ b/config/logging.php @@ -0,0 +1,81 @@ + env('LOG_CHANNEL', 'stack'), + + /* + |-------------------------------------------------------------------------- + | Log Channels + |-------------------------------------------------------------------------- + | + | Here you may configure the log channels for your application. Out of + | the box, Laravel uses the Monolog PHP logging library. This gives + | you a variety of powerful log handlers / formatters to utilize. + | + | Available Drivers: "single", "daily", "slack", "syslog", + | "errorlog", "monolog", + | "custom", "stack" + | + */ + + 'channels' => [ + 'stack' => [ + 'driver' => 'stack', + 'channels' => ['single'], + ], + + 'single' => [ + 'driver' => 'single', + 'path' => storage_path('logs/laravel.log'), + 'level' => 'debug', + ], + + 'daily' => [ + 'driver' => 'daily', + 'path' => storage_path('logs/laravel.log'), + 'level' => 'debug', + 'days' => 7, + ], + + 'slack' => [ + 'driver' => 'slack', + 'url' => env('LOG_SLACK_WEBHOOK_URL'), + 'username' => 'Laravel Log', + 'emoji' => ':boom:', + 'level' => 'critical', + ], + + 'stderr' => [ + 'driver' => 'monolog', + 'handler' => StreamHandler::class, + 'with' => [ + 'stream' => 'php://stderr', + ], + ], + + 'syslog' => [ + 'driver' => 'syslog', + 'level' => 'debug', + ], + + 'errorlog' => [ + 'driver' => 'errorlog', + 'level' => 'debug', + ], + ], + +]; diff --git a/config/queue.php b/config/queue.php index 4d83ebd..efb271b 100644 --- a/config/queue.php +++ b/config/queue.php @@ -62,6 +62,7 @@ 'connection' => 'default', 'queue' => 'default', 'retry_after' => 90, + 'block_for' => null, ], ], diff --git a/config/services.php b/config/services.php index 4460f0e..aa1f7f8 100644 --- a/config/services.php +++ b/config/services.php @@ -22,7 +22,7 @@ 'ses' => [ 'key' => env('SES_KEY'), 'secret' => env('SES_SECRET'), - 'region' => 'us-east-1', + 'region' => env('SES_REGION', 'us-east-1'), ], 'sparkpost' => [ diff --git a/package.json b/package.json index 0985763..7d480e8 100644 --- a/package.json +++ b/package.json @@ -1,22 +1,22 @@ { "private": true, "scripts": { - "dev": "cross-env NODE_ENV=development webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", - "watch": "cross-env NODE_ENV=development webpack --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", - "hot": "cross-env NODE_ENV=development webpack-dev-server --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", - "production": "cross-env NODE_ENV=production webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" + "dev": "npm run development", + "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", + "watch": "npm run development -- --watch", + "watch-poll": "npm run watch -- --watch-poll", + "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", + "prod": "npm run production", + "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" }, "devDependencies": { - "axios": "^0.15.2", - "bootstrap-sass": "^3.3.7", - "jquery": "^3.1.0", - "laravel-mix": "^0.5.0", - "lodash": "^4.16.2", - "vue": "^2.0.1" - }, - "dependencies": { - "bootbox": "^4.4.0", - "font-awesome": "^4.7.0", - "vue-router": "^2.1.2" + "axios": "^0.18", + "bootstrap": "^4.0.0", + "popper.js": "^1.12", + "cross-env": "^5.1", + "jquery": "^3.2", + "laravel-mix": "^2.0", + "lodash": "^4.17.4", + "vue": "^2.5.7" } } diff --git a/phpunit.xml b/phpunit.xml index 8fe8cc8..f6ad675 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -34,5 +34,6 @@ + diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index 9608bc2..fd641f9 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -63,6 +63,7 @@ 'array' => 'The :attribute must have at least :min items.', ], 'not_in' => 'The selected :attribute is invalid.', + 'not_regex' => 'The :attribute format is invalid.', 'numeric' => 'The :attribute must be a number.', 'present' => 'The :attribute field must be present.', 'regex' => 'The :attribute format is invalid.', diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php index 547152f..ff133fb 100644 --- a/tests/CreatesApplication.php +++ b/tests/CreatesApplication.php @@ -2,6 +2,7 @@ namespace Tests; +use Illuminate\Support\Facades\Hash; use Illuminate\Contracts\Console\Kernel; trait CreatesApplication @@ -17,6 +18,8 @@ public function createApplication() $app->make(Kernel::class)->bootstrap(); + Hash::driver('bcrypt')->setRounds(4); + return $app; } } From 452f1128ff9593e9e419ebe54d309f825cfa88c8 Mon Sep 17 00:00:00 2001 From: Charalampos Raftopoulos Date: Mon, 9 Apr 2018 23:21:55 +0300 Subject: [PATCH 2/2] update documentation for Laravel v5.6 --- readme.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index 44e93d0..716344e 100644 --- a/readme.md +++ b/readme.md @@ -28,22 +28,27 @@ If you prefer a video, watch the announcement of The Lucid Architecture at Larac - [Microservices](#microservices) ## Installation -### 5.5 +### 5.6 To start your project with Lucid right away, run the following command: ``` composer create-project lucid-arch/laravel my-project ``` -This will give you a Laravel 5.5 installation with Lucid out-of-the-box. If you wish to download other versions of Laravel you may specify it as well: +This will give you a Laravel 5.6 installation with Lucid out-of-the-box. If you wish to download other versions of Laravel you may specify it as well: + +##### 5.5 +``` +composer create-project lucid-arch/laravel=5.5.x my-project-5.5 +``` + +> Literally 5.5.x and not 5.5.0 or 5.5.1... ##### 5.4 ``` composer create-project lucid-arch/laravel=5.4.x my-project-5.4 ``` -> Literally 5.4.x and not 5.4.0 or 5.4.1... - ##### 5.3 ``` composer create-project lucid-arch/laravel=5.3.x my-project-5.3