PHPackages                             kinglozzer/tinypng - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. kinglozzer/tinypng

ActiveLibrary[Image &amp; Media](/categories/media)

kinglozzer/tinypng
==================

TinyPNG PHP API

0.1.0(11y ago)1292.1k↓18.3%22BSD-3-ClausePHPPHP &gt;=5.3.3

Since Dec 3Pushed 11y ago2 watchersCompare

[ Source](https://github.com/kinglozzer/tinypng)[ Packagist](https://packagist.org/packages/kinglozzer/tinypng)[ RSS](/packages/kinglozzer-tinypng/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (5)Used By (2)

TinyPNG PHP API
===============

[](#tinypng-php-api)

[![Build Status](https://camo.githubusercontent.com/2e3db9121f9f53416aec11b74dcd4b4e414c48c246fa209591dd926b10126534/68747470733a2f2f7472617669732d63692e6f72672f6b696e676c6f7a7a65722f74696e79706e672e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/kinglozzer/tinypng)

Provides an easy-to-use API for interacting with TinyPNG's developer API.

Installation
------------

[](#installation)

`composer require kinglozzer/tinypng:0.1.*`

Usage
-----

[](#usage)

```
use Kinglozzer\TinyPng\Compressor;
use Kinglozzer\TinyPng\Exception\AuthorizationException;
use Kinglozzer\TinyPng\Exception\InputException;
use Kinglozzer\TinyPng\Exception\LogicException;

$compressor = new Compressor('');

try {
    $result = $compressor->compress('/path/to/original.png');
    $result = $compressor->compress('', true); // Compress raw image data
    $result->writeTo('/path/to/compressed.png'); // Write the returned image
    $result->getCompressedFileSize(); // Int size of compressed image, e.g: 104050
    $result->getCompressedFileSize(true); // Human-readable, e.g: '101.61 KB'
    $result->getResponseData(); // array containing JSON-decoded response data
} catch (AuthorizationException $e) {
    // Invalid credentials or requests per month exceeded
} catch (InputException $e) {
    // Not a valid PNG or JPEG
} catch (Exception $e) {
    // Unknown error
}
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~19 days

Total

4

Last Release

4126d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/203294386?v=4)[-&gt; lozcalver](/maintainers/kinglozzer)[@kinglozzer](https://github.com/kinglozzer)

---

Top Contributors

[![lozcalver](https://avatars.githubusercontent.com/u/1655548?v=4)](https://github.com/lozcalver "lozcalver (8 commits)")

---

Tags

phpimagecompressionpngjpgtinypngtinyjpg

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kinglozzer-tinypng/health.svg)

```
[![Health](https://phpackages.com/badges/kinglozzer-tinypng/health.svg)](https://phpackages.com/packages/kinglozzer-tinypng)
```

###  Alternatives

[picqer/php-barcode-generator

An easy to use, non-bloated, barcode generator in PHP. Creates SVG, PNG, JPG and HTML images from the most used 1D barcode standards.

1.8k25.5M88](/packages/picqer-php-barcode-generator)[schmitzal/tinyimg

Image compression for all pngs and jpgs uploaded to the backend (using the tinypng API)

16125.5k](/packages/schmitzal-tinyimg)[choowx/rasterize-svg

A PHP library for converting SVG to JPEG, PNG, and WEBP

2261.7k](/packages/choowx-rasterize-svg)[vajiral/php-image-compare

A light weight PHP class that can compare two (jpg/png) images to find if they are similar.

1797.9k1](/packages/vajiral-php-image-compare)[gtuk/image-optimizer

PHP image optimizer for png, jpeg and gif files. It uses mozjpeg, pngquant and gifsicle for the optimization process

161.6k](/packages/gtuk-image-optimizer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
