Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Glide Laravel Package

league/glide

On-demand image manipulation server for PHP. Resize, crop, and apply effects via a simple HTTP API. Automatically caches transformed images with far-future headers, supports GD/Imagick/libvips, Flysystem storage, multiple response types, and signed URLs for security.

View on GitHub
Deep Wiki
Context7

league/glide is an on-demand image manipulation library for PHP that exposes a simple HTTP-based API, similar to services like Imgix or Cloudinary. Generate responsive images, apply effects, and deliver them efficiently without pre-processing everything upfront.

Glide automatically caches transformed assets and serves them with far-future cache headers, making it ideal for building an image server or embedding directly into your application.

  • Resize, crop, and apply effects via URL parameters
  • Automatic caching of generated images for fast repeat requests
  • Works with GD, Imagick, or libvips backends
  • Storage-agnostic via Flysystem (local, S3, etc.)
  • Optional signed URLs to secure image endpoints
Frequently asked questions about Glide
How do I integrate League/Glide into a Laravel application for dynamic image resizing?
Use Laravel middleware to intercept image requests (e.g., `/images/*`) and delegate them to Glide’s `Server` instance. Register Glide as a service provider to configure source/cache paths, then bind it to Laravel’s container. For Blade templates, create a custom directive like `@glide($imagePath, ['w' => 200])` to generate transformation URLs.
Does League/Glide support Laravel’s queue system for async image processing?
Yes. You can offload image generation to Laravel Queues by creating a custom job (e.g., `GenerateImageJob`) that uses Glide’s `Server` to process images in the background. This is ideal for handling large or complex transformations without blocking the main request.
What Laravel versions does League/Glide officially support?
League/Glide is framework-agnostic but works seamlessly with Laravel 8.x, 9.x, and 10.x. It relies on PHP 8.0+ and PSR-7, so ensure your Laravel app meets these requirements. The package itself doesn’t enforce Laravel-specific dependencies, but integrations (like middleware) may require Laravel 8+ features.
How do I configure Glide to use S3 or other cloud storage with Laravel?
Use Laravel’s `Storage` facade to abstract Flysystem adapters. For example, configure Glide’s `Server` with `Storage::disk('s3')->path()` for the source and cache directories. Glide supports all Flysystem adapters, including S3, Rackspace, and local filesystems, making it compatible with Laravel’s storage configurations.
Can I secure Glide-generated image URLs to prevent malicious transformations?
Yes. Enable URL signatures in Glide’s configuration to validate transformations (e.g., prevent `?w=10000` attacks). In Laravel, add middleware to verify signatures before serving images. This is critical for production to ensure only authorized transformations are processed.
What’s the performance difference between GD, Imagick, and libvips in Glide?
Imagick is fastest for complex operations (e.g., blur, pixelation) but requires the PHP extension. GD is slower but widely available. Libvips offers a balance but needs the `php-vips` extension. For high-throughput Laravel apps (e.g., 1000+ concurrent requests), prioritize Imagick or libvips to avoid bottlenecks.
How do I handle cache invalidation when images are updated in Laravel?
Glide’s cache is file-based (via Flysystem), so manually delete cached files when source images change. For Laravel, trigger cache purging via events (e.g., `ImageUpdated`) or use time-based invalidation (e.g., cache keys with timestamps). Avoid manual deletions in production; automate with Laravel’s filesystem events or queue jobs.
Is League/Glide suitable for a microservice architecture alongside Laravel?
Absolutely. Glide excels as a standalone microservice for image processing, decoupling it from your Laravel app. Deploy it separately (e.g., as a Docker container) and use signed URLs or API calls to transform images. This improves scalability and isolates processing workloads from your main application.
Are there alternatives to League/Glide for Laravel image processing?
Yes. For Laravel-specific solutions, consider `intervention/image` (simpler but less performant) or `spatie/image-optimizer` (for optimization). Cloud services like Cloudinary or Imgix offer managed APIs but require external dependencies. Glide stands out for its HTTP-based API, caching, and Flysystem integration, making it ideal for self-hosted Laravel apps.
How do I test League/Glide in a Laravel CI pipeline?
Mock Glide’s `Server` in unit tests using Laravel’s `Mockery` or PHPUnit. For integration tests, use temporary storage (e.g., `Storage::fake('local')`) and assert generated image paths/headers. Test edge cases like invalid URLs, missing files, and cache behavior. Glide’s PSR-7 compatibility ensures easy testing with Laravel’s HTTP clients.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport