secco2112 / tinify-php-sdk
处理Tinify API请求的PHP SDK。
1.1.1
2021-04-15 23:09 UTC
Requires
- php: >=7.0
- guzzlehttp/guzzle: *
- ralouphie/mimey: *
Requires (Dev)
- phpunit/phpunit: *
- symfony/var-dumper: ^4.4
This package is auto-updated.
Last update: 2024-09-07 00:42:48 UTC
README
这是一个操作Tinify API数据的非官方PHP SDK。以下是一个示例:
<?php 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();
安装
$ composer require secco2112/tinify-php-sdk
{ "require": { "secco2112/tinify-php-sdk": "*" } }
<?php require 'vendor/autoload.php'; use Secco2112\Tinify\Tinify; $tinify = new Tinify;
文档
点击以下部分之一将被重定向到文档
- 入门
- 从文件压缩
- 从URL压缩
- 从二进制字符串压缩
- 处理压缩图像的数据
- 下载图像
- 在路径上保存图像
- 提取压缩图像的二进制字符串
- 缩放方法
- 存储在存储服务中