PHP code example of digitalcorehub / tinypng-laravel

1. Go to this page and download the library: Download digitalcorehub/tinypng-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

digitalcorehub / tinypng-laravel example snippets


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);
bash
php artisan vendor:publish // select TinypngLaravelServiceProvider