2017 © Pedro Peláez
 

library laravel-force-https-url-scheme

Force https url schema middleware for Laravel 5

image

shin1x1/laravel-force-https-url-scheme

Force https url schema middleware for Laravel 5

  • Saturday, April 30, 2016
  • by shin1x1
  • Repository
  • 3 Watchers
  • 27 Stars
  • 14,118 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 2 Open issues
  • 3 Versions
  • 9 % Grown

The README.md

laravel-force-https-url-scheme

Force https url schema middleware for Laravel 5, (*1)

Build Status Latest Stable Version, (*2)

Install

$ composer require shin1x1/laravel-force-https-url-scheme

Usage

This package provide to redirect http to https. It's implemented Illuminate\Contracts\Routing\Middleware interface that means you can use it as Laravel middleware. This feature is enabled in production environments only., (*3)

As global HTTP middleware

  • app/Http/Kernel.php
<?php namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{

    /**
     * The application's global HTTP middleware stack.
     *
     * @var array
     */
    protected $middleware = [
        'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode',
        'Shin1x1\ForceHttpsUrlScheme\ForceHttpsUrlScheme', // <---added
        'Illuminate\Cookie\Middleware\EncryptCookies',
        'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse',
        'Illuminate\Session\Middleware\StartSession',
        'Illuminate\View\Middleware\ShareErrorsFromSession',
        'App\Http\Middleware\VerifyCsrfToken',
    ];}

As route middleware

  • app/Http/Kernel.php
<?php namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
(snip)
    /**
     * The application's route middleware.
     *
     * @var array
     */
    protected $routeMiddleware = [
        'auth' => 'App\Http\Middleware\Authenticate',
        'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth',
        'guest' => 'App\Http\Middleware\RedirectIfAuthenticated',
        'force_https_url_scheme' => 'Shin1x1\ForceHttpsUrlScheme\ForceHttpsUrlScheme', // <---added 
    ];
}
  • app/Http/routes.php
Route::group(['middleware' => 'force_https_url_scheme'], function () {
    get('/admin/', function () {
        // something here
    });
});

The Versions

30/04 2016

dev-master

9999999-dev https://github.com/shin1x1/laravel-force-https-url-scheme

Force https url schema middleware for Laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel middleware

30/04 2016

v1.1.0

1.1.0.0 https://github.com/shin1x1/laravel-force-https-url-scheme

Force https url schema middleware for Laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel middleware

16/04 2015

v1.0.0

1.0.0.0 https://github.com/shin1x1/laravel-force-https-url-scheme

Force https url schema middleware for Laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel middleware