PHP code example of secco2112 / tinify-php-sdk

1. Go to this page and download the library: Download secco2112/tinify-php-sdk 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/ */

    

secco2112 / tinify-php-sdk example snippets




use Secco2112\Tinify\Config;
use Secco2112\Tinify\Options;
use Secco2112\Tinify\Tinify;

$config = new Config([
    Options::TINIFYOPT_API_KEY => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
]);

$tinify = new Tinify;
$tinify->setConfig($config);

$file_url = 'https://tinypng.com/images/example-orig.png';

$tinify->fromUrl($file_url)->download();


Secco2112\Tinify\Tinify;

$tinify = new Tinify;

$ composer 
json
{
    "ecco2112/tinify-php-sdk": "*"
    }
}