Download the PHP package hkhasib/laravel-shortpixel without Composer
On this page you can find all versions of the php package hkhasib/laravel-shortpixel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hkhasib/laravel-shortpixel
More information about hkhasib/laravel-shortpixel
Files in hkhasib/laravel-shortpixel
Package laravel-shortpixel
Short Description Laravel 5+ package for ShortPixel API integration
License MIT
Homepage https://github.com/hkhasib/laravel-shortpixel
Informations about the package laravel-shortpixel
Laravel-Shortpixel
Laravel 5+ wrapper for ShortPixel API. A forked version of davidcb/laravel-shortpixel
Installation
Install via Composer:
If you're using Laravel >= 5.5, you can skip this as this package will be auto-discovered. However, if you want, you can follow these steps for Laravel <=10:
Add the service provider to config/app.php
You can register the facade in the aliases
array in the config/app.php
file
For Laravel >=11, you can optionally follow these steps:
Add the service provider to 'bootstrap/providers.php'
Add the alias to 'bootstrap/app.php'
After adding these things on your laravel app for Laravel <=10 and Laravel >=11, follow these steps:
Publish the config file
Set your API key on your .env file
Usage
You can find all the methods in the original short-pixel-optimizer/shortpixel-php package and davidcb/laravel-shortpixel.
My package is exactly same as David. But, my one automatically generate webp by default. Also, I have added a refresh method.
So, if you want to refresh a previously optimized version of image, you can do it in following way:
Just set $refresh = false or ignore it completely as it is false by default if you don't want to refresh.
Alternatively, you can use refreshFromUrls method to refresh the optimized image.
fromFiles, fromUrls, fromFolder, refreshFromFiles, refreshFromUrls, refreshFromFolder methods are available in this package.
The usage are same as the original package. Only the refresh methods are added in this package.
The compression_level, width, height and maxDimension are optional. Compression levels are 0 - loseless, 1 - lossy, 2- glossy. Default compression level for your images is set on the configuration file (lossy is set as default).
All versions of laravel-shortpixel with dependencies
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0
shortpixel/shortpixel-php Version ^1.0