digitalcorehub / tinypng-laravel
Tinypng Laravel Package
Fund package maintenance!
DigitalCoreHub
Requires
- php: ^8.2
- illuminate/contracts: ^10.0||^11.0
- spatie/laravel-package-tools: ^1.16
- tinify/tinify: ^1.6
Requires (Dev)
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^9.0.0||^8.22.0
- pestphp/pest: ^2.34
- pestphp/pest-plugin-arch: ^2.7
- pestphp/pest-plugin-laravel: ^2.3
This package is not auto-updated.
Last update: 2025-05-05 17:34:19 UTC
README
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.
Installation
You can install the package via composer:
composer require digitalcorehub/tinypng-laravel
You can publish the config file with:
php artisan vendor:publish // select TinypngLaravelServiceProvider
This is the contents of the published config file:
return [ 'api_key' => env('TINYPNG_API_KEY'), ];
Usage
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);
API Reference
Please see API Reference for details.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.