PHP code example of biigle / laravel-file-cache

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

    

biigle / laravel-file-cache example snippets


$app->register(Biigle\FileCache\FileCacheServiceProvider::class);
$app->register(Illuminate\Filesystem\FilesystemServiceProvider::class);

if (!class_exists(FileCache::class)) {
    class_alias(Biigle\FileCache\Facades\FileCache::class, 'FileCache');
}

use FileCache;
use Biigle\FileCache\GenericFile;

// Implements Biigle\FileCache\Contracts\File.
$file = new GenericFile('https://example.com/images/image.jpg');

FileCache::get($file, function ($file, $path) {
    // do stuff
});

use FileCache;
use Biigle\FileCache\GenericFile;

FileCache::fake();
$file = new GenericFile('https://example.com/image.jpg');
$path = FileCache::get($file, function ($file, $path) {
    return $path;
});

$this->assertFalse($this->app['files']->exists($path));