PHP code example of dashed / laravel-drift

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

    

dashed / laravel-drift example snippets


use Dashed\Drift\Config;
use Dashed\Drift\DriftManager;
use Dashed\Drift\CachingStrategies\FilesystemCachingStrategy;

/** @var DriftManager $drift */
$drift = app(DriftManager::class);

$drift->registerConfig(new Config(
    name: 'my-config-name', // Will be used in the slug
    filesystemDisk: 'filesystems-disk-name', // Local, public or s3 for example
    cachingStrategy: FilesystemCachingStrategy::class, // Create your own or use the defaults like FilesystemCachingStrategy or NullCachingStrategy
));

use Dashed\Drift\UrlBuilder;

/** @var UrlBuilder $builder */
$builder = app(UrlBuilder::class);

$image = $builder->url('my-config-name', 'example.png', [
    'resize' => [1920, 1080],
    'encode' => 'webp', // The fallback encoding will be webp
]);