Looking to hire Laravel developers? Try LaraJobs

laravel-force-https maintained by mordisacks

Description
Laravel middleware for forcing https connection
Author
Mordi Sacks
Last update
2021/10/25 11:08 (dev-master)
License
Downloads
7 182

Comments
comments powered by Disqus

Laravel Force HTTPS Middleware

Install

Require this package with composer using the following command:

composer require mordisacks/laravel-force-https

After updating composer, add the service provider to the providers array in config/app.php

MordiSacks\LaravelForceHttps\ServiceProvider::class,

Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

To install this package on only development systems, add the --dev flag to your composer command:

composer require --dev mordisacks/laravel-force-https

Usage

Just add forceHttps to your middleware list

Route::group(['middleware' => ['forceHttps']], function () {
    Route::get('/home', 'HomeController@index')->name('home');
});

Or in a controller

    public function __construct()
    {
        $this->middleware('forceHttps');
    }