PHP code example of shemshad / laravel-blade-minify-plus

1. Go to this page and download the library: Download shemshad/laravel-blade-minify-plus library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shemshad / laravel-blade-minify-plus example snippets


// config/app.php
'providers' => [
    // ...
    BladeMinifyPlus\BladeMinifyPlusServiceProvider::class,
],

use Illuminate\Support\Facades\Route;

Route::view('/about', 'about')->middleware('minify');

use BladeMinifyPlus\Middleware\MinifyHtmlMiddleware;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Middleware;

return Application::configure(basePath: dirname(__DIR__))
    ->withRouting(
        web: __DIR__.'/../routes/web.php',
        commands: __DIR__.'/../routes/console.php',
    )
    ->withMiddleware(function (Middleware $middleware) {
        $middleware->alias([
            'minify' => MinifyHtmlMiddleware::class,
        ]);

        // Optional: apply to all web routes.
        // $middleware->appendToGroup('web', MinifyHtmlMiddleware::class);
    })
    ->create();

protected $middlewareAliases = [
    // ...
    'minify' => \BladeMinifyPlus\Middleware\MinifyHtmlMiddleware::class,
];

return [
    'enabled' => env('BLADE_MINIFY_PLUS_ENABLED', true),

    'skip_routes' => [
        'api.docs',
        'webhooks.receive',
    ],

    'options' => [
        'doRemoveComments' => true,
        'doSumUpWhitespace' => true,
    ],
];
bash
php artisan vendor:publish --tag=blade-minify-plus-config
bash
php -l src/BladeMinifyPlusServiceProvider.php
php -l src/Middleware/MinifyHtmlMiddleware.php
php -l config/blade-minify-plus.php