Download the PHP package daikazu/laravel-glider without Composer

On this page you can find all versions of the php package daikazu/laravel-glider. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-glider

Latest Version on Packagist GitHub Tests Action Status Total Downloads

Laravel Glider

On-the-fly image manipulation for Laravel using League/Glide. Transform, optimize, and serve images with elegant Blade components.

Features

Installation

Requires Laravel 13+ and PHP 8.3+. Older Laravel versions can use the previous major version of this package, which is no longer developed. See UPGRADE.md when you're ready to move to v4.

Publish configuration:

The cache directory is created automatically with .gitignore added.

Quick Start

Basic Image

Responsive Image

Background Image

Responsive Background

Using the Facade

Upgrading from v3? Component tags (x-glide-*x-glider-*), the facade (GlideGlider), the config file (config/laravel-glider.phpconfig/glider.php), and environment variables (GLIDE_*GLIDER_*) were all renamed in v4. See UPGRADE.md for the full mapping and step-by-step instructions.

Usage Guide

Image Manipulation

All Glide parameters are supported with the glide- prefix:

Sizing

Quality & Format

Effects

Focal Points

Control image positioning within its container using CSS:

Available positions: center, top, bottom, left, right, top-left, top-right, bottom-left, bottom-right

How it works:

Presets

Define reusable configurations in config/glider.php:

Use in components:

Background Images

Create responsive backgrounds with automatic media queries:

Custom breakpoints:

Background presets in config:

Remote Images

Process images from external URLs automatically:

Remote images are fetched, processed, and cached locally. Default config values apply automatically. Fetching is handled by a first-party, read-only HTTP filesystem adapter built on Laravel's own HTTP client — no extra dependencies or configuration required.

Components Reference

<x-glider-img>

Basic image with transformations.

Attributes:

<x-glider-img-responsive>

Responsive image with automatic srcset generation.

Attributes:

<x-glider-bg>

Background image container (non-responsive). For breakpoint-based background_presets, use <x-glider-bg-responsive> — this component renders a single background image (use glide-preset for regular manipulation presets).

Attributes:

<x-glider-bg-responsive>

Responsive background with media queries.

Attributes:

Glide Parameters

Common parameters (use glide- prefix in components):

Parameter Values Description
w pixels Width
h pixels Height
fit crop, contain, fill, max Resize mode
fit crop-{position} Crop with position (e.g., crop-top, crop-center)
fit crop-{x}-{y}[-{zoom}] Crop with focal point/zoom (e.g., crop-25-75-2)
q 1-100 Quality
fm jpg, png, webp, avif Format
blur 0-100 Blur amount
bri -100 to 100 Brightness
con -100 to 100 Contrast
filt greyscale, sepia Filter

See full Glide documentation for all parameters.

Artisan Commands

Clear image cache:

Cached conversions are byte-identical whether they came from glider:build or an on-the-fly request, so within a single cache store there is no "prebuilt only" filter — but since the baked static tier and the runtime cache are separate stores in the hybrid recipe, --static lets you clear either one independently.

Prebuild all statically discoverable image conversions:

Convert HTML img tags to components:

Only tags with a statically-resolvable src are converted — plain paths and asset('literal') wrappers. Dynamic sources (:src bindings, Blade echoes, url()/Vite::asset()/Storage::url() helpers, concatenated asset() expressions) are left untouched. All other attributes survive with their order, names, and quoting intact.

Use --image-path to declare which public-URL prefix maps to your glider source root — that prefix is stripped from converted srcs (leading slashes don't matter on either side):

Always check the --dry-run preview: converted srcs must resolve relative to your configured glider.source.

See Prebuilding the Cache below for details on glider:build.

Configuration

Key options in config/glider.php:

source, cache, and watermarks each accept either a plain path string or a Laravel disk reference (['disk' => 's3', 'prefix' => 'glider']) — see Disk-Based Cache below.

League/Glide 4.1 also adds a strip parameter (add 'strip' => true to defaults or a preset) to remove EXIF/metadata — such as GPS coordinates — from generated images. It's documented in the published config but left disabled by default.

Prebuilding the Cache (glider:build)

php artisan glider:build scans your Blade templates (by default, everything under resources/views, configurable via glider.build.paths) for <x-glider-img>, <x-glider-img-responsive>, <x-glider-bg>, <x-glider-bg-responsive>, and Glider::url() usages whose src is a literal string, and generates their cache entries ahead of time — using the exact same param resolution a live request would use. This means the first real request for a prebuilt conversion is already a cache hit.

Usages with a dynamic src (a variable or expression rather than a literal string) can't be discovered by scanning and are reported as skipped rather than silently ignored — they'll still be processed on-the-fly at request time. The command reports generated / skipped (dynamic src) / failed counts, and exits non-zero if any conversion failed to generate.

CI example — run the build step after your asset build so the cache is warm before the release ships:

Pair this with 'on_the_fly' => false (see Security below) to make production serve nothing but pre-warmed cache entries — zero request-time image processing.

Disk-Based Filesystems & Deployment Recipes

source, cache, and watermarks in config/glider.php each accept either a plain path string or a Laravel disk reference:

Since .env can't express arrays (or call path helpers), both forms are also available as environment variables:

(GLIDER_SOURCE_DISK/GLIDER_SOURCE_PREFIX and GLIDER_WATERMARKS_DISK/GLIDER_WATERMARKS_PREFIX work the same way.)

Note: a non-local source (any disk reference other than the local filesystem) disables automatic width()/height() attributes and automatic srcset width calculation, since both require reading the source image's dimensions from disk. An explicit srcset-widths list still works.

The static-serve property

Glider's cache layout mirrors its URL structure. If the cache root is public/{base_url} (default: public/img), a cached conversion is a real file at exactly the path its URL requests — so the web server serves it as a static file and PHP is never invoked. Anything not in the cache falls through to the Laravel route as usual. This one property powers the recipes below; no extra configuration is involved.

Recipe 1: Single server (simplest)

A classic VPS/Forge box. Point the cache at public/img, keep on-the-fly enabled, and optionally prebuild on deploy:

Prebuilt conversions are static-served from day one; anything dynamic is generated once on first request, lands in public/img, and is static-served from then on. Choose this when you deploy to one or more persistent servers with a durable local disk.

Recipe 2: Shared cloud cache (ephemeral/autoscaling infrastructure)

Laravel Cloud, Vapor, Kubernetes — anywhere instances are ephemeral, local writes don't survive, and replicas must share state:

Every instance — including fresh autoscale replicas — shares the same warm bucket cache. Dynamic (CMS/database-driven) images are generated once globally on first request, and the platform CDN caches everything after the first serve (Glider sends public, max-age=1yr headers). Choose this when everything is dynamic or you want the fewest moving parts on cloud infrastructure.

Recipe 3: Hybrid — baked static + shared dynamic (best of both)

For sites where most images are local/static assets but some come from a CMS or database. Bake the static conversions into the deployment artifact at build time with --static, while the runtime cache points at the shared bucket:

How the split works — with zero routing configuration:

The web server itself decides which tier serves each request, simply by whether the file exists. Choose this when a meaningful share of your images are static template assets and you want them served at static-file speed even on ephemeral infrastructure.

Which recipe?

Your situation Recipe
Persistent server(s), durable disk 1 — local public/img cache
Ephemeral/autoscaling, mostly dynamic images 2 — shared bucket
Ephemeral/autoscaling, mostly static images 3 — baked + bucket

All three use the same package configuration surface — they differ only in env values and where glider:build runs.

Requirements

Security

Laravel Glider implements multiple security layers to protect your application from common attacks. These features work together to ensure safe image processing.

Three-Layer Security Model

Beyond automatic protections (path traversal, XSS, SSRF), Glider offers three independent, stackable layers you can combine to control how much of the parameter space is reachable at request time:

  1. URL Signing (secure) — every URL must carry a valid HMAC signature, so only your application can mint valid image URLs. Primary defense; keep enabled in production.
  2. On-the-Fly Kill Switch (on_the_fly) — once you've warmed the cache for the conversions you actually use (via php artisan glider:build), disable on-the-fly generation entirely. Requests for already-cached conversions are served normally; requests for anything uncached 404 instead of invoking the image processor.
  3. Presets-Only Mode (restrict_to_presets) — restricts allowed manipulations to your configured presets (plus defaults-only and format-only requests), rejecting anything else with a 403.

These compose freely: signed URLs only, signed + presets-only, on-the-fly disabled after a cache-warming step, or any combination.

URL Signing

Status: Enabled by default (GLIDER_SECURE=true)

URL signing prevents unauthorized image manipulation and protects against denial-of-service attacks. When enabled, all image URLs are cryptographically signed using your application key.

Important: URL signing should NEVER be disabled in production environments. Unsigned URLs allow attackers to:

The signing mechanism uses Laravel's APP_KEY by default. Ensure your application key is:

On-the-Fly Kill Switch

Status: Enabled by default (GLIDER_ON_THE_FLY=true)

When on_the_fly is disabled, the server never runs the image processor at request time — a request for a conversion that's already in cache is served from cache; a request for anything not already cached returns a

  1. This turns image processing into a build-time step rather than a request-time one.

Pair this with php artisan glider:build in your CI/deploy pipeline: warm the cache for every conversion your templates statically reference, then disable on_the_fly so production does zero request-time image processing. Any usage with a dynamic src (not discoverable by the build scan) will 404 under this mode unless it happens to already be cached from an earlier request.

Presets-Only Mode

Status: Disabled by default (GLIDER_RESTRICT_TO_PRESETS=false)

When enabled, any request whose parameters don't exactly match a configured preset's expansion (or a defaults-only / format-only request) is rejected with a 403. This collapses the reachable parameter space down to (number of images) × (number of presets), closing off the arbitrary-parameter attack surface even when signed URLs are otherwise trusted.

Important: this is not an absolute "presets only" guarantee — format conversions via the URL's file extension (.webp, .avif, etc.) are still permitted even when the request's other params don't match any preset, because the route itself already whitelists which extensions are accepted (jpg, pjpg, png, gif, webp, avif, tiff). The practical guarantee is "images × presets × whitelisted extensions," not "presets only."

Path Traversal Protection

Laravel Glider validates all file paths to prevent directory traversal attacks. The package automatically:

Example of blocked attacks:

These protections are automatic and require no configuration.

XSS Protection

Background image components sanitize CSS values to prevent cross-site scripting attacks via CSS injection:

The package validates and sanitizes:

SSRF Protection

When processing remote images via URLs, Laravel Glider protects against Server-Side Request Forgery (SSRF) attacks:

Protections implemented:

These protections prevent attackers from:

All SSRF protections are automatic and require no configuration.

Security Best Practices

Follow these recommendations to maintain secure image processing:

  1. Keep URL signing enabled

  2. Use a strong application key

  3. Validate source paths

  4. Limit maximum image dimensions

  5. Keep the package updated

  6. Use HTTPS in production

    • Protects signed URLs from interception
    • Prevents man-in-the-middle attacks on image requests
  7. Configure appropriate cache permissions

  8. Consider restrict_to_presets for user-influenced sources

  9. Consider on_the_fly=false once your cache is warm

Reporting Security Issues

If you discover a security vulnerability, please email [[email protected]] or use the GitHub Security Advisory feature. Do not create public issues for security vulnerabilities.

Testing

Resources

Credits

License

MIT License. See LICENSE.md for details.


All versions of laravel-glider with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
guzzlehttp/guzzle Version ^7.8
illuminate/contracts Version ^13.0
league/flysystem-path-prefixing Version ^3.0
league/glide Version ^4.1
spatie/laravel-package-tools Version ^1.92
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package daikazu/laravel-glider contains the following files

Loading the files please wait ...