1. Go to this page and download the library: Download tleckie/versioned-assets 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/ */
tleckie / versioned-assets example snippets
use Tleckie\Assets\Bucket;
use Tleckie\Assets\Versioned\Versioned;
$bucket = new Bucket(new Versioned('v1'), '/path');
// Relative path
$bucket->url('js/app.js');
//result: /path/js/app.js?v1
// Absolute path
$bucket->url('/js/app.js');
//result: /js/app.js?v1
use Tleckie\Assets\Bucket;
use Tleckie\Assets\Versioned\Versioned;
$bucket = new Bucket(
new Versioned('v1', "%s?custom-version=%s"),
'/path'
);
// Relative path
$bucket->url('js/app.js');
//result: /path/js/app.js?custom-version=v1
// Absolute path
$bucket->url('/js/app.js');
//result: /js/app.js?custom-version=v1
use Tleckie\Assets\Bucket;
use Tleckie\Assets\Versioned\Versioned;
$bucket = new Bucket(
new Versioned('v1', '%s?version=%s'),
'//domain.cookieless.com'
);
// Relative path
$bucket->url('js/app.js');
//result: //domain.cookieless.com/js/app.js?version=v1
// Absolute path
$bucket->url('/js/app.js');
//result: //domain.cookieless.com/js/app.js?version=v1
use Tleckie\Assets\Bucket;
use Tleckie\Assets\Versioned\Versioned;
$bucket = new Bucket(
new Versioned('v1', '%2$s/%1$s'),
'//domain.cookieless.com'
);
// Version in path
$bucket->url('js/app.js');
//result: //domain.cookieless.com/v1/js/app.js
use Tleckie\Assets\Bucket;
use Tleckie\Assets\Versioned\NullVersioned;
$bucket = new Bucket(
new NullVersioned(),
'//domain.cookieless.com'
);
// Relative path
$bucket->url('js/app.js');
//result: //domain.cookieless.com/js/app.js
use Tleckie\Assets\Bucket;
use Tleckie\Assets\Versioned\JsonManifestVersioned;
$bucket = new Bucket(
new JsonManifestVersioned(__DIR__ .'/json/rev-manifest.json')
);
$bucket->url('css/app.css');
//result: build/css/app.af316426ea1d10021f3f17ce8031f93c2.css
$bucket->url('js/app.js');
//result: build/js/app.56fa630905267b809161e71d0f8a0c017b.js
use Tleckie\Assets\Bucket;
use Tleckie\Assets\Versioned\JsonManifestVersioned;
$bucket = new Bucket(
new JsonManifestVersioned(__DIR__ .'/json/rev-manifest.json'),
'//domain.cookieless.com'
);
$bucket->url('css/app.css');
//result: //domain.cookieless.com/build/css/app.af316426ea1d10021f3f17ce8031f93c2.css
$bucket->url('js/app.js');
//result: //domain.cookieless.com/build/js/app.56fa630905267b809161e71d0f8a0c017b.js
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.