https://github.com/tinify/tinify-php
PHP client for the Tinify API.
https://github.com/tinify/tinify-php
image-compression image-optimization php tinify-api tinyjpg tinypng
Last synced: 5 months ago
JSON representation
PHP client for the Tinify API.
- Host: GitHub
- URL: https://github.com/tinify/tinify-php
- Owner: tinify
- License: mit
- Created: 2015-05-15T13:46:24.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-03-02T15:15:25.000Z (over 2 years ago)
- Last Synced: 2024-04-04T07:03:30.672Z (over 1 year ago)
- Topics: image-compression, image-optimization, php, tinify-api, tinyjpg, tinypng
- Language: PHP
- Homepage: https://tinypng.com/developers
- Size: 519 KB
- Stars: 234
- Watchers: 18
- Forks: 51
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE
Awesome Lists containing this project
README
[ ](https://github.com/tinify/tinify-php/blob/main/LICENSE)
[](https://github.com/tinify/tinify-php/actions/workflows/ci-cd.yaml)
[](https://packagist.org/packages/tinify/tinify)
[](https://packagist.org/packages/tinify/tinify)# Tinify API client for PHP
PHP client for the Tinify API, used for [TinyPNG](https://tinypng.com) and [TinyJPG](https://tinyjpg.com). Tinify compresses your images intelligently. Read more at [http://tinify.com](http://tinify.com).
## Documentation
[Go to the documentation for the PHP client](https://tinypng.com/developers/reference/php).
## Installation
Install the API client with Composer. Add this to your `composer.json`:
```json
{
"require": {
"tinify/tinify": "*"
}
}
```Then install with:
```
composer install
```Use autoloading to make the client available in PHP:
```php
require_once("vendor/autoload.php");
```## Usage
```php
Tinify\setKey("YOUR_API_KEY");
Tinify\fromFile("unoptimized.png")->toFile("optimized.png");
```## Running tests
```
composer install
vendor/bin/phpunit
```### Integration tests
```
composer install
TINIFY_KEY=$YOUR_API_KEY vendor/bin/phpunit --no-configuration test/integration.php
```## License
This software is licensed under the MIT License. [View the license](LICENSE).