PHP code example of basteyy / plates-local-assets-copy

1. Go to this page and download the library: Download basteyy/plates-local-assets-copy 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/ */

    

basteyy / plates-local-assets-copy example snippets


use League\Plates\Engine;
use basteyy\PlatesLocalAssetsCopy\PlatesLocalAssetsCopy as PlatesLocalAssetsCopy;

$templateEngine = new Engine();
$templateEngine->loadExtension(new PlatesLocalAssetsCopy(
    __DIR__ . '/cache/', // Define where the file is stored
    '/public/path') // Define the public access to the file 
);

// Inside your template-file:
<?= $this->cacheLocal('https://example.com/file') 

// Controller for example
use League\Plates\Engine;
use basteyy\PlatesLocalAssetsCopy\PlatesLocalAssetsCopy as PlatesLocalAssetsCopy;

$templateEngine = new Engine();
$templateEngine->loadExtension(new PlatesLocalAssetsCopy(
    __DIR__ . '/cache/', // Define where the file is stored
    '/public/path') // Define the public access to the file 
);

// Inside your template-file:
<?= $this->cacheLocal('https://cdnjs.cloudflare.com/ajax/libs/mini.css/3.0.1/mini-default.min.css')