PHP code example of tonysm / importmap-laravel

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

    

tonysm / importmap-laravel example snippets


php artisan importmap:optimize



use Tonysm\ImportmapLaravel\Facades\Importmap;

// Other pins...
Importmap::pin("alpinejs", to: "/js/vendor/alpinejs.js"); //@3.8.1

Importmap::pin("app", to: "/js/app.js");

Importmap::pinAllFrom("resources/js/", to: "js/");

Importmap::pin("alpinejs", to: "/js/vendor/alpinejs.js"); // @3.8.1

Importmap::pin("alpinejs", to: "/js/vendor/alpinejs.js"); // @3.8.1

Importmap::pinAllFrom("resources/js/", to: "js/", preload: true);
Importmap::pin("alpinejs", to: "https://unpkg.com/[email protected]/dist/module.esm.js", preload: true); // @3.8.1
bash
php artisan importmap:install
bash
php artisan storage:link
bash
php artisan importmap:pin alpinejs
bash
php artisan importmap:pin alpinejs --from=unpkg
bash
php artisan importmap:outdated
bash
php artisan importmap:audit