mohamedhk2/laravel-prod-tools

v1.0.5 2023-05-17 13:38 UTC

This package is auto-updated.

Last update: 2024-03-27 13:26:55 UTC


README

Total Downloads Latest Unstable Version License

Packages

anhskohbo/no-captcha
cviebrock/eloquent-sluggable
diglactic/laravel-breadcrumbs
ecrmnn/laravel-https
intervention/image
jorenvanhocht/laravel-share
laravel/ui
mcamara/laravel-localization
morningtrain/laravel-https
redcenter/laravel-non-www-redirect
spatie/laravel-medialibrary
spatie/laravel-translatable

Removed packages

packagereplaced byversionreason
morningtrain/laravel-httpsecrmnn/laravel-httpsonly v1.0.3Not 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 # used by morningtrain/laravel-https USE_SSL=false ```

OR

using morningtrain/laravel-http - **Deploy** the config file : ``` bash php artisan vendor:publish --provider="MorningTrain\Laravel\Https\LaravelHttpsServiceProvider" # OR php artisan vendor:publish --tag=mt-config ``` - **Update** the following in your `.env`: ```dotenv # used by morningtrain/laravel-https USE_SSL=true # used by ecrmnn/laravel-https HTTPS=false ``` - **Register the ForceSSL middleware as a global middleware in :** - **Laravel 10** and below: `App\Http\Kernel.php` ```php protected $middleware = [ ... \MorningTrain\Laravel\Https\Http\Middleware\ForceSSL::class, ]; ``` - **Laravel 11** and above : `bootstrap/app.php` ```php ->withMiddleware(function (Middleware $middleware) { $middleware->use([ ... \MorningTrain\Laravel\Https\Http\Middleware\ForceSSL::class, ]) ```

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,
        ]);
      })
      
  • 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