定制 gmbf-package/cloudflare-image-upload 二次开发

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

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

gmbf-package/cloudflare-image-upload

最新稳定版本:v1.0.2

Composer 安装命令:

composer require gmbf-package/cloudflare-image-upload

包简介

Provides an easy-to-use interface to upload, delete, and fetch images from Cloudflare Images API in Laravel projects.

README 文档

README

This Laravel package provides a simple and reusable interface for uploading, retrieving, and deleting images on Cloudflare Images.
It is intended for use in Laravel applications to handle image storage through the Cloudflare Images API.

A reusable Laravel package to easily upload, retrieve, and delete images on Cloudflare Images.
Supports Laravel 5.x → 12.x and PHP 7.0 → 8.4. Works with both request files (UploadedFile) and storage file paths.

Features

  • Upload images directly from request or local storage
  • Get image details from Cloudflare
  • Delete images from Cloudflare
  • Ready-to-use Facade and ServiceProvider
  • Configurable via config/cloudflare-image.php
  • Laravel projects reuse-ready
  • Clean, maintainable architecture

📦 Installation

  1. Require the package via Composer:
composer require gmbf-package/cloudflare-image-upload
  1. (Optional for Laravel <5.5) Add the service provider manually in config/app.php:
'providers' => [
    Gmbf\CloudflareImageUpload\CloudflareImageServiceProvider::class,
],
  1. Publish the config file:
php artisan vendor:publish --provider="Gmbf\CloudflareImageUpload\CloudflareImageServiceProvider" --tag="cloudflare-image-config"

⚙️ Configuration

Add the following to your .env file:

CLOUDFLARE_API_TOKEN=your_cloudflare_api_token
CLOUDFLARE_ACCOUNT_ID=your_cloudflare_account_id
CLOUDFLARE_IMAGES_KEY=your_optional_key
CLOUDFLARE_IMAGES_DELIVERY_URL=https://your-delivery-url.com
CLOUDFLARE_IMAGES_DEFAULT_VARIATION=your-variant-name

After publishing, you can customize the settings in config/cloudflare-image.php.

🚀 Usage

Upload an image to Cloudflare

use Gmbf\CloudflareImageUpload\Facades\CloudflareImage;

// From request
CloudflareImage::upload(request()->file('image'));

// From storage path
CloudflareImage::upload(storage_path('app/public/example.jpg'));

Get image details

CloudflareImage::get('image_id');

Delete an image from Cloudflare

CloudflareImage::delete('image_id');

🛠️ Folder Structure

gmbf-package/cloudflare-image-upload/
├── composer.json
├── config/
│   └── cloudflare-image.php
├── src/
│   ├── CloudflareImageServiceProvider.php
│   ├── CloudflareImageService.php
│   ├── Facades/
│   │   └── CloudflareImage.php
│   └── Exceptions/
│       └── CloudflareException.php
├── tests/
│   └── CloudflareImageTest.php
├── README.md
└── LICENSE

📄 License

This package is open-sourced software licensed under the MIT license.

🙌 Credits

Developed and maintained by GMBF Group.

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-27