定制 gwhthompson/laravel-cloudflare-transforms 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

Tests codecov Latest Version License Total Downloads PHP Version

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固