1. Go to this page and download the library: Download felixl7/laravel-asset 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/ */
felixl7 / laravel-asset example snippets
use FelixL7\Asset\Facades\Asset;
Asset::bootstrap()->min()->js();
//<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script>
use FelixL7\Asset\Facades\Asset;
use FelixL7\Asset\Libs\Bootstrap;
use FelixL7\Asset\Libs\JQuery;
use FelixL7\Asset\Libs\Swiper;
Asset::register([
Bootstrap::class,
JQuery::class,
Swiper::class
]);
use FelixL7\Asset\CDNs\Cdnjs;
use FelixL7\Asset\CDNs\JsDelivr;
return [
//main cdn -> $libName in library
'bootstrap' => [
//use asset version -> ,
],
'swiper' => [
'version' => '6.5.8',
],
]
];
use FelixL7\Asset\CDNs\Cdnjs;
use FelixL7\Asset\CDNs\JsDelivr;
return [
//main cdn -> ries
'libs' => [
//libName, must match $libName in library
'bootstrap' => [
//use asset version -> ot configured cache_version will be 1
'cache_config_version' => true,
//Load assets asynchronous
'loading_attribute' => 'async',
],
'jquery' => [
'version' => '3.6.0',
],
'swiper' => [
'version' => '6.5.8',
],
]
];
//css()
Asset::bootstrap()->css();
//<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.css" rel="stylesheet">
//If hasCss() returns false, en empty string will be returned
//cssUrl()
Asset::bootstrap()->cssUrl();
//https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.css
//If hasCss() returns false, en empty string will be returned
//js()
Asset::bootstrap()->js();
//<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.js"></script>
//If hasJs() returns false, en empty string will be returned
//jsUrl()
Asset::bootstrap()->jsUrl();
//https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.js
//If hasJs() returns false, en empty string will be returned
//sync()
Asset::bootstrap()->sync()->js();
Asset::bootstrap()->defer()->sync()->js();
//<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.js"></script>
//async()
Asset::bootstrap()->async()->js();
Asset::bootstrap()->defer()->async()->js();
//<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.js" async></script>
//defer()
Asset::bootstrap()->defer()->js();
Asset::bootstrap()->async()->defer()->js();
//<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.js" defer></script>
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.