PHPackages                             zakurdaev/yii2-image-ratio-validator - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. zakurdaev/yii2-image-ratio-validator

ActiveYii2-extension[Validation &amp; Sanitization](/categories/validation)

zakurdaev/yii2-image-ratio-validator
====================================

Use editor.js in form. Module for Yii2

0331PHP

Since Jul 8Pushed 5y ago1 watchersCompare

[ Source](https://github.com/zakurdaev/yii2-image-ratio-validator)[ Packagist](https://packagist.org/packages/zakurdaev/yii2-image-ratio-validator)[ RSS](/packages/zakurdaev-yii2-image-ratio-validator/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

ImageRatioValidator for Yii 2
=============================

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

`Image Ratio Validator` allows you to add image validation by its aspect ratio.

Install
-------

[](#install)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
$ php composer.phar require --prefer-dist zakurdaev/yii2-image-ratio-validator "*"
```

or add

```
"zakurdaev/yii2-image-ratio-validator": "*"
```

to the `require` section of your `composer.json` file.

Usage
-----

[](#usage)

Once the extension is installed, simply use it in your code:

### Strict validate

[](#strict-validate)

```
    public function rules()
    {
        return [
            [['image'], zakurdaev\imageratio\ImageRatioValidator::class, 'ratios' => 1600/1200],
        ];
    }
```

### Range validate

[](#range-validate)

```
    public function rules()
    {
        return [
            [['image'], zakurdaev\imageratio\ImageRatioValidator::class, 'ratios' => ['from' => 1400/1200, 'to' => 1600/1200]],
        ];
    }
```

### Multiple validate

[](#multiple-validate)

```
    public function rules()
    {
        return [
            [['image'], zakurdaev\imageratio\ImageRatioValidator::class, 'ratios' => [
                16/9,
                ['from' => 100/50, 'to' => 150/50]
            ]],
        ];
    }
```

License
-------

[](#license)

The BSD License (BSD). Please see [License File](LICENSE.md) for more information.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/78f12131aa9486d3be1a581457aaabad9c1c381fb9f936dda27c8ca2455ff20b?d=identicon)[zakurdaev](/maintainers/zakurdaev)

---

Top Contributors

[![zakurdaev](https://avatars.githubusercontent.com/u/4710771?v=4)](https://github.com/zakurdaev "zakurdaev (5 commits)")

---

Tags

yiiyii2yii2-extension

### Embed Badge

![Health badge](/badges/zakurdaev-yii2-image-ratio-validator/health.svg)

```
[![Health](https://phpackages.com/badges/zakurdaev-yii2-image-ratio-validator/health.svg)](https://phpackages.com/packages/zakurdaev-yii2-image-ratio-validator)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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