PHP code example of robopuff / tinypng

1. Go to this page and download the library: Download robopuff/tinypng 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/ */

    

robopuff / tinypng example snippets


$tinyPng = new \TinyPng\TinyPng(new \TinyPng\Client\GuzzleClient('your_api_key'));
$tinyPng
    ->optimize(new \TinyPng\Input\Filesystem('unoptimized_image.png'))
    ->store(new \TinyPng\Output\Storage\Filesystem('optimized_image.png'));