Download the PHP package dedmytro/laravel-cloudflare-images without Composer
On this page you can find all versions of the php package dedmytro/laravel-cloudflare-images. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dedmytro/laravel-cloudflare-images
More information about dedmytro/laravel-cloudflare-images
Files in dedmytro/laravel-cloudflare-images
Package laravel-cloudflare-images
Short Description Cloudflare API client and filesystem for Laravel
License MIT
Informations about the package laravel-cloudflare-images
Cloudflare Images
Provides access to Cloudflare Images API for Laravel projects
Table of contents
- Installation
- Configuration
- Using
Installation
To get the latest version of Laravel CloudflareImages
, simply require the project using Composer:
Or manually update require
block of composer.json
and run composer update
.
Configuration
Add environment variables to your .env file:
or publish config and set up vars there
CLOUDFLARE_IMAGES_KEY
- is an API Token
. To create a new one go to User Api Tokens on Cloudflare dashboard
CLOUDFLARE_IMAGES_ACCOUNT
- is an Account ID
on the Overview page
CLOUDFLARE_IMAGES_DELIVERY_URL
- is an Image Delivery URL
on the Overview page
CLOUDFLARE_IMAGES_DEFAULT_VARIATION
- is a variation on the Variants page
CLOUDFLARE_IMAGES_SIGNATURE_TOKEN
- is a token from the Images -> Keys page
Using
Direct upload
The Direct upload is feature of Cloudflare Images to upload image directly from frontend but without sharing your api key. Once you get this url you can use inside your html
<form method="post" enctype="multipart/form-data" action="{{ $uploadUrl }}">
IMPORTANT: You can use this url only once!
Upload
Call upload()
method and pass file as local file path or UploadedFile
instance. As a result of upload you'll get DetailsResponse
instance with uploaded
image details, so you can save it locally.
List
To list existing images you should use list()
method which also has pagination and accept $page
and $perPage
arguments.
Details
To get existing image details you should use get($id)
method where $id
is image identifier you received when you list or upload the image.
Delete
To delete existing image you should use delete($id)
method where $id
is image identifier you received when you list or upload the image.
Public url
To generate image url locally call method url($id)
and pass image ID. Don't forget to set up
Signed url
To generate signed image url locally call method signedUrl($id, $expires = 3600)
and pass image ID and expiration time in seconds. Don't forget to set up
All versions of laravel-cloudflare-images with dependencies
illuminate/support Version ^7.0|^8.0|^9.0|^10.0|^11.0
guzzlehttp/guzzle Version ^6.2.1|^7.0