PHPackages                             petrabarus/yii2-eithervalidator - 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. petrabarus/yii2-eithervalidator

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

petrabarus/yii2-eithervalidator
===============================

Yii2 validator to force one of certain attributes to be filled

115.4k↓100%2[1 issues](https://github.com/petrabarus/yii2-eithervalidator/issues)PHP

Since Feb 12Pushed 11y ago2 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

yii2-eithervalidator
====================

[](#yii2-eithervalidator)

Yii2 validator to force one of attributes to be filled.

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

[](#installation)

Add the following line to the composer.

```
"petrabarus/yii2-eithervalidator": "*"

```

Usage
-----

[](#usage)

Add the a line similar to the following to rule of the model

```
[['email'], PetraBarus\Yii2\Validators\EitherValidator::class,
	'otherAttributes' => ['phone']]
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/c1261f29f95a5ca228a04c8415431baf0fb6c397ec83e93e3454fb0b55718c5e?d=identicon)[petrabarus](/maintainers/petrabarus)

---

Top Contributors

[![petrabarus](https://avatars.githubusercontent.com/u/523289?v=4)](https://github.com/petrabarus "petrabarus (3 commits)")

### Embed Badge

![Health badge](/badges/petrabarus-yii2-eithervalidator/health.svg)

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

###  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)
