|
| 1 | +*Si vous souhaitez lire ce fichier README en français, [cliquez ici](https://github.com/WinXaito/laravel-https/blob/master/README_fr.md).* |
| 2 | + |
| 3 | +# Laravel HTTPS redirection |
| 4 | +This package aims to redirect your HTTP requests to HTTPS very simply. |
| 5 | + |
| 6 | +## Installation |
| 7 | + |
| 8 | +*NB: This package has not been tested below Laravel 5.5* |
| 9 | + |
| 10 | + |
| 11 | +First, use the function below: |
| 12 | + |
| 13 | +``` |
| 14 | +composer require winxaito/laravel-https |
| 15 | +``` |
| 16 | + |
| 17 | +If you don't use auto-discovery, add the ServiceProvider to the providers |
| 18 | +array in `config/app.php` |
| 19 | + |
| 20 | +```php |
| 21 | +WinXaito\LaravelHttpsRedirect\LaravelHttpsServiceProvider::class, |
| 22 | +``` |
| 23 | + |
| 24 | +If you want to work with the configurations without going through an environment |
| 25 | +file, run the following command and then edit the `config/https-redirection.php` |
| 26 | +file |
| 27 | + |
| 28 | +```php |
| 29 | +php artisan vendor:publish --provider="WinXaito\LaravelHttpsRedirect\LaravelHttpsServiceProvider" |
| 30 | +``` |
| 31 | + |
| 32 | +## How to use it ? |
| 33 | + |
| 34 | +This package works with environment variables in order of priority. |
| 35 | +List of constants in order of priority: |
| 36 | + |
| 37 | +- `HTTPS_FORCE`: If this value is true, then in all cases the requests will be |
| 38 | +redirected to *HTTPS*, otherwise we go to the following constant: |
| 39 | +- `HTTPS_PROHIBIT`: If this constant is true, the queries will not be redirected, |
| 40 | +if it is false, then we go to the following constant: |
| 41 | +- `APP_ENV`: If this constant is *production*, then we redirect to *HTTPS*, |
| 42 | +otherwise we go to the following constant: |
| 43 | +- `APP_DEBUG`: If the application is not in debug mode, it is redirected to |
| 44 | +*HTTPS*, unless *HTTPS_PROHIBIT* is true. If the application is in debug mode |
| 45 | +then the address will not be redirected. |
| 46 | + |
| 47 | + |
| 48 | +By default if no environment variable is defined we have the following values: |
| 49 | + |
| 50 | +- `HTTPS_FORCE = false` |
| 51 | +- `HTTPS_PROHIBIT = false` |
| 52 | +- `APP_ENV = production` |
| 53 | +- `APP_DEBUG = false` |
| 54 | + |
| 55 | +Therefore by default the redirection is enabled. |
| 56 | + |
| 57 | +## License |
| 58 | + |
| 59 | +The license is GNU GPL3, therefore if you use this you must respect the |
| 60 | +indications of the license. For proprietary software that would like to |
| 61 | +use this library without making their source code available, please contact me. |
0 commit comments