https://github.com/padosoft/laravel-https
laravel package to force redirect to https schema
https://github.com/padosoft/laravel-https
https laravel laravel-package redirect ssl
Last synced: 8 months ago
JSON representation
laravel package to force redirect to https schema
- Host: GitHub
- URL: https://github.com/padosoft/laravel-https
- Owner: padosoft
- License: mit
- Created: 2018-05-09T09:25:18.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-17T14:24:57.000Z (over 7 years ago)
- Last Synced: 2025-04-18T01:47:28.053Z (9 months ago)
- Topics: https, laravel, laravel-package, redirect, ssl
- Language: PHP
- Size: 27.3 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Laravel Package to force https redirect.
[](https://packagist.org/packages/padosoft/laravel-https)
[](LICENSE.md)
[](https://scrutinizer-ci.com/g/padosoft/laravel-https)
[](https://travis-ci.org/padosoft/laravel-https)
[](https://packagist.org/packages/padosoft/laravel-https)
This package provides a laravel middleware to force https redirect.
Table of Contents
=================
* [Laravel Package to force https redirect.](#laravel-package-to-force-https-redirect)
* [Requires](#requires)
* [Installation](#installation)
* [USAGE](#usage)
* [Change log](#change-log)
* [Testing](#testing)
* [Contributing](#contributing)
* [Security](#security)
* [Credits](#credits)
* [About Padosoft](#about-padosoft)
* [License](#license)
##Requires
- "php" : ">=5.6.0",
- laravel/framework": "~5.2"
## Installation
You can install the package via composer:
``` bash
$ composer require padosoft/laravel-https
```
### FOR LARAVEL 5.6+
No additional steps required because the service provider use new L5.5+ autodiscovery feature.
### FOR LARAVEL <=5.5
You must install this service provider.
``` php
// config/app.php
'provider' => [
...
Padosoft\Laravel\Https\LaravelHttpsServiceProvider::class,
...
];
```
### publish config (optional)
Optionally publish the packages config file by running the following from your projects root folder:
```bash
php artisan vendor:publish --tag=laravel-https
```
### register the middleware
Add the middleware to your routes or controller. See Usage.
## USAGE
### From Route File:
You can include the HttpsForce in a route groups or on individual routes.
### Route Group Example:
``` php
Route::group(['middleware' => ['web', 'HttpsForce']], function () {
Route::get('/', 'WelcomeController@welcome');
});
```
### Individual Route Examples:
``` php
Route::get('/', 'WelcomeController@welcome')->middleware('HttpsForce');
Route::match(['post'], '/test', 'Testing\TestingController@runTest')->middleware('HttpsForce');
```
### From Controller File:
You can include the HttpsForce in the constructor of your controller file.
### Controller File Example:
``` php
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('HttpsForce');
}
```
## Change log
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Testing
``` bash
$ composer test
```
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security
If you discover any security related issues, please email instead of using the issue tracker.
## Credits
- [Lorenzo Padovani](https://github.com/lopadova)
- [All Contributors](../../contributors)
## About Padosoft
Padosoft (https://www.padosoft.com) is a software house based in Florence, Italy. Specialized in E-commerce and web sites.
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.