gwhthompson/laravel-cloudflare-transforms
最新稳定版本:v3.2.3
Composer 安装命令:
composer require gwhthompson/laravel-cloudflare-transforms
包简介
Fluent API for Cloudflare Image Transformation URLs in Laravel
关键字:
README 文档
README
Fluent API for Cloudflare Image Transformations.
Installation
Requires PHP 8.3+ and Laravel 11+.
composer require gwhthompson/laravel-cloudflare-transforms
Set your disk's url to a Cloudflare-proxied domain:
// config/filesystems.php 'media' => [ 'driver' => 's3', 'url' => env('CLOUDFLARE_CDN_URL'), // https://cdn.example.com // ... ],
Usage
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()
Blade Component
<x-cloudflare:image path="hero.jpg" :width="1200" :fit="Fit::Cover" :srcset="[320, 640, 960, 1280]" sizes="(max-width: 640px) 100vw, 50vw" />
Enums
| Enum | Values |
|---|---|
Fit |
Contain, Cover, Crop, Pad, ScaleDown, Squeeze |
Format |
Auto, Avif, Jpeg, Webp |
Quality |
High, MediumHigh, MediumLow, Low |
Gravity |
Auto, Top, Bottom, Left, Right, Face |
Configuration
php artisan vendor:publish --tag=cloudflare-transforms-config
| Option | Default | Purpose |
|---|---|---|
domain |
null |
Fallback for CloudflareImage::make() |
transform_path |
cdn-cgi/image |
Custom path with URL rewrite |
validate_file_exists |
true |
Disable for performance |
Testing
# .env.testing
CLOUDFLARE_VALIDATE_FILE_EXISTS=false
Security
Report vulnerabilities to security@unfetter.co.
License
MIT
统计信息
- 总下载量: 146
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-17