PHP code example of gwhthompson / laravel-cloudflare-transforms
1. Go to this page and download the library: Download gwhthompson/laravel-cloudflare-transforms 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/ */
gwhthompson / laravel-cloudflare-transforms example snippets
// config/filesystems.php
'media' => [
'driver' => 's3',
'url' => env('CLOUDFLARE_CDN_URL'), // https://cdn.example.com
// ...
],
Storage::disk('media')->image('photo.jpg')
->width(400)
->format(Format::Auto)
->url();
// → https://cdn.example.com/cdn-cgi/image/w=400,f=auto/photo.jpg
// Responsive srcset
Storage::disk('media')->image('hero.jpg')
->srcset([320, 640, 960, 1280]);
// Convenience methods
->optimize() // format=auto, quality=high
->thumbnail(150) // square crop
->grayscale()
bash
php artisan vendor:publish --tag=cloudflare-transforms-config