infinity-it/laravel-prod-tools

v1.0.0 2024-10-21 18:54 UTC

This package is auto-updated.

Last update: 2025-02-21 19:38:35 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
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

using ecrmnn/laravel-https
  • 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:
    ⚠️ HTTPS will only be forced when env('HTTPS') is set to true ⚠️

    # 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