Looking to hire Laravel developers? Try LaraJobs

laravel-prod-tools maintained by infinity-it

Description
Laravel Prod Tools
Author
Last update
2024/10/21 20:54 (dev-main)
License
Downloads
109

Comments
comments powered by Disqus

Laravel Prod Tools

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
redcenter/laravel-non-www-redirect
spatie/laravel-medialibrary
spatie/laravel-translatable

Install

The recommended way to install this is through composer:

composer require "infinity-it/laravel-prod-tools:1.0.0"

Laravel Force SSL

  • Add under providers in config/app.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
        protected $middleware = [
            ...
            \Ecrmnn\LaravelHttps\Http\Middleware\ForceHttps::class,
        ];
      
    • Laravel 11 and above : bootstrap/app.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:

    # used by ecrmnn/laravel-https
    HTTPS=true
    

Laravel non-WWW Redirect

  • Deploy the config file:

    php artisan vendor:publish --provider="Mohamedhk2\LaravelProdTools\Providers\NonWwwRedirectServiceProvider"
    # OR
    php artisan vendor:publish --tag=hk2-www
    
  • Add the middleware class:

    • 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:

    REDIRECT_TO_WWW=true
    

License

The Laravel Prod Tools is open-sourced software licensed under the MIT license