Download the PHP package yamanhacioglu/laravel-glide without Composer

On this page you can find all versions of the php package yamanhacioglu/laravel-glide. 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-glide

Use Glide with ease directly in Laravel views

Latest Version on Packagist GitHub Run Tests Action Status GitHub Format Code Action Status Coverage Status Total Downloads

This package simplifies the use of the Glide image manipulation library within Laravel applications. It provides a secure and efficient way to serve optimized, enhanced, and responsive images with minimal effort.

Key features include:

Thanks To lukasmu. This repo is a fork of [lukasmu/laravel-glide] and updated to the latest version of Intervention/Image and Laravel 12

Installation

You can install the package via composer:

You may publish the config file with:

It is highly recommended to add an additional symbolic link in your configuration file:

The additional link ensures that cached images can be served directly to the users of your Laravel application. Do not forget to run the command after adding the additional symbolic link (see https://laravel.com/docs/filesystem#the-public-disk).

If you plan to modify the package views, you can publish them with:

Usage

URL generator

You can generate image URLs using the Glide facade:

This will generate a URL such as http://localhost/glide/v2/aW1hZ2UuanBn/eyJibHVyIjoiNSIsInciOiI1MDAifQ.png?s=ac50711366fe50e5e03c6c0a312f3f75. When hitting this URL, a 500px wide, slightly blurred version of image.jpg located in your directory, will be automatically generated.

The first argument must be an image located in your public directory or in a remote location. The second argument should contain the image manipulation parameters. You can use any Glide image manipulation options.

View component

Furthermore, you can use the provided view component. In your Blade templates, you can simply use:

This will render the following img element and ensures a truly responsive experience for the users of your Laravel application. No need to ever worry again about manually building responsive img elements!

Use the data-glide-* attributes to specify image manipulation parameters. Use other attributes as you would normally do on img elements (e.g. the alt attribute).

Clear cache command

Finally, you can remove all cached images by calling:

Comparison to similar packages

spatie/laravel-glide

The spatie/laravel-glide package originally provided on-the-fly image manipulation but dropped this feature in version 3.

In contrast, lukasmu/laravel-glide fully supports dynamic image manipulation, which is particularly beneficial for responsive images where required dimensions vary. Since images are generated on demand, there is no need to pre-create and store images of multiple sizes. While this introduces a slight performance cost on the first request, an optimized caching mechanism ensures fast subsequent loads.

ralphjsmit/laravel-glide

The ralphjsmit/laravel-glide package focuses solely on responsive image generation.

lukasmu/laravel-glide offers a broader feature set, including all available Glide transformations. Furthermore, it integrates better with/makes heavy use of advanced Laravel features, such as middleware (enhancing security) and view components (making the package straightforward to use).

Technical details

URL structure

The package encodes both the image path and its manipulation parameters using a slightly modified base64 encoding method. These encoded values are then included directly in the URL path. This differs from Glide's default behavior, where the image path remains unencoded and parameters are passed as query string values (e.g., http://localhost/glide/v1/image.jpg?w=500&blur=5). Please note that this package also supports Glide's default behavior via redirects.

This approach offers two main advantages:

This method ensures optimal performance while maintaining the security and flexibility of on-the-fly image manipulations.

URL signing

Generated URLs contain a signature derived from the APP_KEY environment variable. This prevents unauthorized use of your Laravel application as a remote image manipulation service or as an image proxy. URL validation is enforced via middleware.

Image component

The srcset attribute in the Blade component is automatically generated. It:

The different widths are not static. They rather depend on the original width and size of the image. The larger the original image, the more versions are requested. The motivation and mechanism has been adopted from https://spatie.be/docs/laravel-medialibrary/v11/responsive-images/using-your-own-width-calculator.

The loading attribute is set to 'lazy' by default while the sizes attribute is set to 'auto'. This appears to be the most pragmatic approach. These values can be overridden to fine-tune the performance of your Laravel application.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Contributions are welcome and will be fully credited. Feedback is very much appreciated as well.

Please see CONTRIBUTING for details.

Testing

The package includes tests written for the Pest PHP testing framework which can be run by calling:

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see LICENSE for more information.


All versions of laravel-glide with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/console Version ^10.0||^11.0||^12.0
illuminate/contracts Version ^10.0||^11.0||^12.0
illuminate/filesystem Version ^10.0||^11.0||^12.0
illuminate/http Version ^10.0||^11.0||^12.0
illuminate/support Version ^10.0||^11.0||^12.0
illuminate/view Version ^10.0||^11.0||^12.0
intervention/image Version ^3.0
league/flysystem Version ^3.29
league/glide Version ^3.0.1
ntzrbtr/flysystem-http Version ^1.1
symfony/http-foundation Version ^6.0||^7.0
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 yamanhacioglu/laravel-glide contains the following files

Loading the files please wait ...