tinypng-laravel is a Laravel package that provides an easy and seamless way to integrate the TinyPNG API into your Laravel application. This package allows you to compress, optimize, and resize images programmatically, ensuring faster load times and reduced storage usage.
You can install the package via composer:
composer require digitalcorehub/tinypng-laravelYou can publish the config file with:
php artisan vendor:publish // select TinypngLaravelServiceProviderThis is the contents of the published config file:
return [
'api_key' => env('TINYPNG_API_KEY'),
];use DigitalCoreHub\TinypngLaravel\Facades\TinypngLaravel;
TinypngLaravel::compressFromUrl("https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png", $outputPath);
TinypngLaravel::compressFromFile($inputPath, $outputPath);
TinypngLaravel::compressFromBuffer("base64", $outputPath);
TinypngLaravel::resize($inputPath, $outputPath, $options);Please see API Reference for details.
composer testPlease see CHANGELOG for more information on what has changed recently.
The MIT License (MIT). Please see License File for more information.