-
Notifications
You must be signed in to change notification settings - Fork 0
Getting started
Gustavo Marmentini edited this page Apr 20, 2021
·
1 revision
This library was created to assist in the image optimization process from the Tinify API. In addition to the methods included in the API itself, this library brings some methods that help in post-processing.
To install the library just import it with Composer.
$ composer require secco2112/tinify-php-sdk
or
{
"require": {
"secco2112/tinify-php-sdk": "*"
}
}
To use the library it is necessary to have an access key. Access this link to request a key. With the key in hand, just instantiate the main class. To do this it is necessary to use the configuration class and the options class.
use Secco2112\Tinify\Config;
use Secco2112\Tinify\Options;
use Secco2112\Tinify\Tinify;
$config = new Config([
Options::TINIFYOPT_API_KEY => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' // here's your api key
]);
$tinify = new Tinify;
$tinify->setConfig($config);
With the $tinify
variable you can now perform all the requests available in the API!