PHPackages                             bigbrush/yii2-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. bigbrush/yii2-tinypng

ActiveYii2-extension[Image &amp; Media](/categories/media)

bigbrush/yii2-tinypng
=====================

TinyPng for Yii 2

6109.3k↓42.2%2PHP

Since Mar 23Pushed 9y agoCompare

[ Source](https://github.com/bigbrush/yii2-tinypng)[ Packagist](https://packagist.org/packages/bigbrush/yii2-tinypng)[ RSS](/packages/bigbrush-yii2-tinypng/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

TinyPng for Yii 2
=================

[](#tinypng-for-yii-2)

TinyPng provides an Yii2 integration of [TinyPng](https://tinypng.com).

With it you can compress PNG and JPG images without loosing image quality. You can also resize images while also compressing the images in the process.

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

[](#installation-)

Run the following command

```
composer require "bigbrush/yii2-tinypng:dev-master"
```

Or add this to your composer file

```
"bigbrush/yii2-tinypng": "dev-master"
```

Usage
------

[](#usage-)

**Image compression/optimizing**

```
$tiny = new TinyPng(['apiKey' => 'YOUR API KEY']);

// compress image - overwrite file
$tiny->compress('path/to/file/to/compress');
// compress image - create a new image
$tiny->compress('path/to/file/to/compress', 'path/to/file/after/compression');
// get current monthly compression count
$count = $tiny->usage();
```

**Image resizing**

Image resizing requires a configuration array to be passed.

```
[
    'method' => 'fit',
    'width' => 150,
    'height' => 100,
]
```

Available methods are: - scale - fit - cover

See [TinyPng docs](https://tinypng.com/developers/reference/php#resizing-and-compressing-images) for information about each method.

```
// resize image - overwrite file
$tiny->resize('path/to/file/to/resize', null, ['method' => 'fit', 'width' => 150, 'height' => 100]);
// resize image - create a new image
$tiny->resize('path/to/file/to/resize', 'path/to/file/after/resizing', ['method' => 'fit', 'width' => 150, 'height' => 100]);
```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.5% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a3b91bbf133e0280ac87e463e8d2806fcf019e57a0ed46edadff422733444d0a?d=identicon)[mj@bechtech.dk](/maintainers/mj@bechtech.dk)

---

Top Contributors

[![MichaelBech](https://avatars.githubusercontent.com/u/45620472?v=4)](https://github.com/MichaelBech "MichaelBech (7 commits)")[![chaimleich](https://avatars.githubusercontent.com/u/7976661?v=4)](https://github.com/chaimleich "chaimleich (1 commits)")

### Embed Badge

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

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

###  Alternatives

[goat1000/svggraph

Generates SVG graphs

135911.1k3](/packages/goat1000-svggraph)[gravatarphp/gravatar

Gravatar URL builder which is most commonly called as a Gravatar library

16653.6k2](/packages/gravatarphp-gravatar)[rsoury/wp-imgix

Rewrites WordPress image URLs to use ImgIX

167.2k](/packages/rsoury-wp-imgix)

PHPackages © 2026

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