mohamedhk2 / laravel-prod-tools
Laravel Prod Tools
v1.0.6
2024-09-05 14:10 UTC
Requires
- anhskohbo/no-captcha: *
- cviebrock/eloquent-sluggable: *
- diglactic/laravel-breadcrumbs: *
- ecrmnn/laravel-https: *
- intervention/image: *
- jorenvanhocht/laravel-share: *
- laravel/ui: *
- mcamara/laravel-localization: *
- redcenter/laravel-non-www-redirect: *
- spatie/laravel-medialibrary: *
- spatie/laravel-translatable: *
Conflicts
README
Packages
Removed packages
package | replaced by | version | reason |
---|---|---|---|
None | ^1.0.6 | Not support Laravel ^11.x | |
ecrmnn/laravel-https | only v1.0.3 | Not support Laravel ^9.x |
Install
The recommended way to install this is through composer:
composer require "mohamedhk2/laravel-prod-tools"
Laravel Force SSL
using ecrmnn/laravel-https
- Add under `providers` in `config/app.php`
```php
/*
* Package Service Providers...
*/
\Ecrmnn\LaravelHttps\Providers\ServiceProvider::class,
```
- **Register the middleware as a global middleware in :**
- **Laravel 10** and below: `App\Http\Kernel.php`
```php
protected $middleware = [
...
\Ecrmnn\LaravelHttps\Http\Middleware\ForceHttps::class,
];
```
- **Laravel 11** and above : `bootstrap/app.php`
```php
->withMiddleware(function (Middleware $middleware) {
$middleware->use([
...
\Ecrmnn\LaravelHttps\Http\Middleware\ForceHttps::class,
])
```
- **Update** the following in your `.env`:
:warning: *HTTPS will only be forced when `env('HTTPS')` is set to `true`* :warning:
```dotenv
# used by ecrmnn/laravel-https
HTTPS=true
```
Laravel non-WWW Redirect
Deploy the config file:
^1.0.5
php artisan vendor:publish --provider="Mohamedhk2\LaravelProdTools\Providers\NonWwwRedirectServiceProvider" # OR php artisan vendor:publish --tag=hk2-www
Add the middleware class:
^1.0.5
- Laravel 10 and below:
App\Http\Kernel.php
protected $middlewareGroups = [ 'web' => [ ... \Mohamedhk2\LaravelProdTools\Middlewares\LaravelNonWwwRedirectMiddleware::class, ], ];
- Laravel 11 and above :
bootstrap/app.php
->withMiddleware(function (Middleware $middleware) { $middleware->web([ ... \Mohamedhk2\LaravelProdTools\Middlewares\LaravelNonWwwRedirectMiddleware::class, ]); })
- Laravel 10 and below:
Update the following in your
.env
:^1.0.5
REDIRECT_TO_WWW=true
License
The Laravel Prod Tools is open-sourced software licensed under the MIT license