laravel-https maintained by novay
Description
Laravel Https is middleware to force us to access Secure HTTP requests.
Author
Last update
2018/01/28 06:15
(dev-master)
License
Downloads
35
Tags
Laravel Force HTTPS
About
Laravel Https is middleware to force us into Secure HTTP requests.
Requirements
Installation Instructions
-
From your projects root folder in terminal run:
composer require novay/laravel-https -
Register the package
-
Laravel 5.5 and up Uses package auto discovery feature, no need to edit the
config/app.phpfile. -
Laravel 5.4 and below Register the package with laravel in
config/app.phpunderproviderswith the following:
'providers' => [ ... Novay\ForceHttps\ForceHttpsServiceProvider::class, ]; -
-
Optionally publish the packages views, config file, and language files by running the following from your projects root folder:
php artisan vendor:publish --tag=laravel-https -
Add the middleware to your routes or controller. See Usage.
Configuration
laravel-https can be configured in directly in /config/laravel-https.php if you published the assets.
Or you can variables to your .env file.
Usage
From Route File:
- You can include the
httpsin a route groups or on individual routes.
Route Group Example:
Route::group(['middleware' => ['https']], function () {
Route::get('/', 'WelcomeController@welcome');
});
Individual Route Examples:
Route::get('/', 'WelcomeController@welcome')->middleware('https');
From Controller File:
- You can include the
httpsin the contructor of your controller file.
Controller File Example:
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('https');
}
License
Laravel-Https is licensed under the MIT license. Enjoy!