PHPackages                             aegisora/is-array-rule - 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. aegisora/is-array-rule

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

aegisora/is-array-rule
======================

Rule-based is array validation in Aegisora ecosystem

v1.0.0(4w ago)00MITPHPPHP &gt;=7.4

Since May 11Pushed 4w agoCompare

[ Source](https://github.com/Aegisora/is-array-rule)[ Packagist](https://packagist.org/packages/aegisora/is-array-rule)[ Docs](https://github.com/Aegisora/is-array-rule)[ RSS](/packages/aegisora-is-array-rule/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Aegisora Is Array Rule
======================

[](#aegisora-is-array-rule)

[![Code Coverage Badge](./badge.svg)](./badge.svg)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![PHPStan Badge](https://camo.githubusercontent.com/83dd3d35cebed0eab9ee97ff1a5849c1344cda6a8ee9cac2cda20f5aa55b67bd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230392d627269676874677265656e2e7376673f7374796c653d666c6174)](https://camo.githubusercontent.com/83dd3d35cebed0eab9ee97ff1a5849c1344cda6a8ee9cac2cda20f5aa55b67bd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230392d627269676874677265656e2e7376673f7374796c653d666c6174)

Is Array Rule provides a simple and strict **array type validation** for the Aegisora ecosystem.

The package is built on top of `aegisora/rule-contract` and follows its validation architecture, ensuring predictable and safe behavior.

---

✨ Features
----------

[](#-features)

- 🔹 Minimalistic implementation with no extra dependencies
- 🔹 Strict array validation using `is_array`
- 🔹 Fully compatible with Aegisora validation pipeline
- 🔹 Clear `Context → Result` flow
- 🔹 No raw booleans — only structured `Result`
- 🔹 Safe execution via base `Rule` abstraction
- 🔹 Convenient static factory method (`create`)
- 🔹 Lightweight and predictable behavior

---

📦 Installation
--------------

[](#-installation)

```
composer require aegisora/is-array-rule
```

---

🚀 Core Concept
--------------

[](#-core-concept)

This package performs array validation:

- accepts a value via `Context`
- checks whether the value is an array
- returns a standardized `Result`

Supported values:

```
[]
['foo', 'bar']
['key' => 'value']
```

Unsupported values:

```
null
true
123
'string'
new stdClass()
```

---

🏗️ Basic Usage
--------------

[](#️-basic-usage)

### ✅ Validate array value

[](#-validate-array-value)

```
use Aegisora\Rules\IsArrayRule;
use Aegisora\RuleContract\Models\Context;

$result = IsArrayRule::create()->validate(
    Context::create(['name' => 'John'])
);

if ($result->isValid()) {
    // value is array
} else {
    // value is not array
}
```

---

### ❌ Invalid value example

[](#-invalid-value-example)

```
use Aegisora\Rules\IsArrayRule;
use Aegisora\RuleContract\Models\Context;

$result = IsArrayRule::create()->validate(
    Context::create('not-array')
);

if ($result->isValid()) {
    // will not happen
} else {
    // validation failed
}
```

---

🧩 Factory Method
----------------

[](#-factory-method)

```
IsArrayRule::create();
```

Creates a new instance of `IsArrayRule`.

---

⚠️ Validation Rules
-------------------

[](#️-validation-rules)

Validation internally uses PHP native function:

```
is_array($value)
```

The rule returns:

- valid `Result` → if value is array
- invalid `Result` → if value is not array

No exceptions are thrown for unsupported types.

---

🏛️ Architecture
---------------

[](#️-architecture)

This package relies on `aegisora/rule-contract`.

Validation flow:

1. `validate()` is called
2. `Context` is passed
3. `executeValidate()` is executed
4. `is_array()` check is performed
5. A `Result` is returned

All logic is encapsulated within the base `Rule` abstraction.

---

⚖️ License
----------

[](#️-license)

This package is open-source and licensed under the MIT License. See the LICENSE for details.

---

🌱 Contributing
--------------

[](#-contributing)

Contributions are welcome and greatly appreciated!. See the CONTRIBUTING for details.

---

🌟 Support
---------

[](#-support)

If you find this project useful, please consider giving it a star on GitHub!

It helps the project grow and motivates further development.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance94

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

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

Unknown

Total

1

Last Release

29d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/81402dcd0a07ad550b7f80f5871e7c302770b29d4c73a52fc35ba697f702d56e?d=identicon)[arslanim](/maintainers/arslanim)

---

Top Contributors

[![arslanim](https://avatars.githubusercontent.com/u/22678154?v=4)](https://github.com/arslanim "arslanim (27 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")

---

Tags

aegisoraaegisora-ecosystemis-array-checkis-array-rulephprule-based-is-array-predicate-checkphpaegisoraaegisora-ecosystemis-array-validationis-array-validation-rule

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/aegisora-is-array-rule/health.svg)

```
[![Health](https://phpackages.com/badges/aegisora-is-array-rule/health.svg)](https://phpackages.com/packages/aegisora-is-array-rule)
```

PHPackages © 2026

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