PHP code example of zmyslny / laravel-inline-scripts

1. Go to this page and download the library: Download zmyslny/laravel-inline-scripts 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/ */

    

zmyslny / laravel-inline-scripts example snippets


class AppServiceProvider extends ServiceProvider 
{
    public function boot(): void 
    {
        BladeInlineScripts::takeFiles(
            resource_path('js/your-first-script.js'),
            resource_path('js/your-second-script.js'),
            ...
        )->registerAs('myInlineScripts');
    }
}

use Zmyslny\LaravelInlineScripts\Ready\ColorSchemeSwitchTwoStates\InitScript;
use Zmyslny\LaravelInlineScripts\Ready\ColorSchemeSwitchTwoStates\SwitchScript;

class AppServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        BladeInlineScripts::take(
            new InitScript(),
            new SwitchScript('d') // toggle dark & light modes with 'd' key
        )->registerAs('colorScheme');
    }
}