Skip to content
smallPict

Resmi PHP SDK

Laravel, Symfony ve PHP projeleri için smallpict/smallpict-php paketi.

PHP 7.4 ile 8.3+ arası tüm sürümlerle uyumlu, PSR-7 ve PSR-18 standartlarına tam entegre kütüphane.


Kurulum

Shell
composer require smallpict/smallpict-php

Kapsamlı Kullanım Örneği

PHP
<?phprequire 'vendor/autoload.php';
use SmallPict\Client as SmallPictClient;
$client = new SmallPictClient(    getenv('SMALLPICT_API_KEY'),    getenv('SMALLPICT_SECRET_KEY'));
// 1. Görseli optimize edin$fileData = file_get_contents('photo.jpg');$result = $client->optimize($fileData, [    'format'  => 'avif',    'quality' => 80]);
echo "Optimize Edilmiş URL: " . $result->url . "\n";echo "Tasarruf: " . $result->savingsPercentage . "%\n";
// 2. Kotayı sorgulayın$quota = $client->getQuota();echo "Plan: " . $quota->plan . "\n";