PHP code example of rzl-zone / blade-minify

1. Go to this page and download the library: Download rzl-zone/blade-minify 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/ */

    

rzl-zone / blade-minify example snippets


php artisan vendor:publish --tag=RzlZoneBladeMinify

\RzlZone\BladeMinify\Middleware\RzlBladeOutputMinifier::class

RZLZONE_MINIFY_ENABLE=true

RZLZONE_MINIFY_ENABLE=false

RZLZONE_MINIFY_ONLY_PROD=true

RZLZONE_MINIFY_ONLY_PROD=false

'ignore_route_name' => [
  // 'dashboard',
  // 'home',
]

use RzlZone\BladeMinify\Facades\RzlBladeMinify;

// Manually compress a raw HTML layout string
$compressedHtml = RzlBladeMinify::minify("<div>  <p>Hello World</p>  </div>");

// Explicitly isolate a string container from compression cycles
$isolatedHtml = RzlBladeMinify::ignoreMinify("<code>  preserve   whitespace  </code>");



return [
  /*
    |--------------------------------------------------------------------------
    | Core Minifier Settings
    |--------------------------------------------------------------------------
    */
  'enable'              => env('RZLZONE_MINIFY_ENABLE', true),
  'run_production_only' => env('RZLZONE_MINIFY_ONLY_PROD', false),
  'ignore_route_name'   => [],

  /*
    |--------------------------------------------------------------------------
    | Custom Vite Configuration
    |--------------------------------------------------------------------------
    |
    | This array contains the configuration settings for the custom Vite asset
    | bundler integration, including build directories, CSP nonce settings,
    | and manifest/hot file tracking.
    |
    | WARNING: If you modify these values, ensure that your `vite.config.js`
    | configuration (such as build.outDir, build.manifest, or server settings)
    | is updated accordingly to match these paths and filenames.
    |
    */
  "custom-vite" => [
    /*
      |--------------------------------------------------------------------------
      | Build Directory
      |--------------------------------------------------------------------------
      |
      | This value determines the directory where compiled frontend assets
      | will be stored. The framework and asset helpers may use this path
      | when resolving built files and generated manifests.
      |
      | If changed, make sure to update the `build.outDir` in `vite.config.js`
      | (e.g., `public/custom-build-dir`).
      |
      */
    "build_dir" => env("APP_BUILD_DIR", "build"),

    /*
      |--------------------------------------------------------------------------
      | Use Asset Nonce
      |--------------------------------------------------------------------------
      |
      | This option determines whether a nonce attribute should be applied
      | to generated asset tags. Enabling this can help satisfy Content
      | Security Policy (CSP)