| Package Data | |
|---|---|
| Maintainer Username: | jeremykenedy |
| Maintainer Contact: | jeremykenedy@gmail.com (Jeremy Kenedy) |
| Package Create Date: | 2017-11-12 |
| Package Last Update: | 2023-02-26 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-30 03:03:44 |
| Package Statistics | |
|---|---|
| Total Downloads: | 129,713 |
| Monthly Downloads: | 834 |
| Daily Downloads: | 24 |
| Total Stars: | 36 |
| Total Watchers: | 3 |
| Total Forks: | 5 |
| Total Open Issues: | 0 |
Laravel Https is middleware to check for Secure HTTP requests. Laravel Https has can check for HTTPS and throw an error or automatically redirect to HTTPS.
| laravel-https Features |
| :------------ |
|forceHTTPS middlware to check if URL is HTTPS and redirect to HTTPS if not.|
|checkHTTPS middlware to check if URL is HTTPS and throw an error if not.|
|Each middleware can be used in individual controllers constructor|
|Each middleware can be used as a middleware on individual routes|
|Each middleware can be used as a middleware route group|
|Returns HTML for HTTP requests|
|Returns JSON for API requests|
|Uses localized language files|
From your projects root folder in terminal run:
composer require jeremykenedy/laravel-https
Register the package
Laravel 5.5 and up
Uses package auto discovery feature, no need to edit the config/app.php file.
Laravel 5.4 and below
Register the package with laravel in config/app.php under providers with the following:
'providers' => [
...
jeremykenedy\LaravelHttps\LaravelHttpsServiceProvider::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=LaravelHttps
Add the middleware to your routes or controller. See Usage.
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.
Here are the .env file variables available:
LARAVEL_HTTP_ERROR_CODE=403
checkHTTPS or forceHTTPS in a route groups or on individual routes. Route::group(['middleware' => ['web', 'checkHTTPS']], function () {
Route::get('/', 'WelcomeController@welcome');
});
Route::get('/', 'WelcomeController@welcome')->middleware('checkHTTPS');
Route::match(['post'], '/test', 'Testing\TestingController@runTest')->middleware('forceHTTPS');
checkHTTPS or forceHTTPS in the contructor of your controller file. /**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('forceHTTPS');
}

├── .gitignore
├── LICENSE
├── README.md
├── composer.json
└── src
├── LaravelHttpsServiceProvider.php
├── app
│ └── Http
│ └── Middleware
│ ├── CheckHTTPS.php
│ └── ForceHTTPS.php
├── config
│ └── laravel-https.php
└── resources
├── lang
│ └── en
│ └── laravel-https.php
└── views
└── errors
└── 403.blade.php
brew install tree
tree -a -I '.git|node_modules|vendor|storage|tests'
Before opening an issue there are a couple of considerations:
Open source projects are a the community’s responsibility to use, contribute, and debug.
Laravel-https is licensed under the MIT license. Enjoy!