PHPackages                             extalion/php-strict-array - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. extalion/php-strict-array

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

extalion/php-strict-array
=========================

Generator for generic arrays (vector, map)

0.1.0(6y ago)18MITPHPPHP ^7.2

Since Dec 18Pushed 6y ago1 watchersCompare

[ Source](https://github.com/eXtalionLab/php-strict-array)[ Packagist](https://packagist.org/packages/extalion/php-strict-array)[ RSS](/packages/extalion-php-strict-array/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

Prepare for future with php-strict-array
========================================

[](#prepare-for-future-with-php-strict-array)

According to this [article](https://www.sitepoint.com/creating-strictly-typed-arrays-collections-php/)which shows how to create strictly typed arrays and collections in Php7, php-strict-array was born.

---

There is some [discusion](https://wiki.php.net/rfc/generic-arrays) about generic in Php but who knows when it comes to us.

It is not exacly what you know from **Java** or **C++** where generic looks like `array()` or `array()`.

Here strict arrays looks like `array_int_`, `array_bool_` and `array_string_and_float_` so I hope when they come to nativ Php all what you need to do will be:

1. Replace all `new array_User`, `new array_string_and_array_object__` to `array`, `array`.

Now you do not have to validate array from user inside your packages:

```
function foo(array $users)
{
    foreach ($users as $user) {
        if (!$user instanceof User) {
            thorw new \InvalidArgumentException();
        }
    }

    ...
}
```

Your code can be much simpler:

```
function foo(array_User_ $users)
{
    ...
}
```

Install
-------

[](#install)

```
composer require eXtalion/php-strict-array
```

Base strict arrays
------------------

[](#base-strict-arrays)

Some base arrays are generated:

- `array_array_`,
- `array_bool_`,
- `array_callable_`,
- `array_float_`,
- `array_int_`,
- `array_iterable_`,
- `array_object_`,
- `array_string_`,
- `array_string_and_array_`,
- `array_string_and_bool_`,
- `array_string_and_callable_`,
- `array_string_and_float_`,
- `array_string_and_int_`,
- `array_string_and_iterable_`,
- `array_string_and_object_`,
- `array_string_and_string_`.

Create new strict array
-----------------------

[](#create-new-strict-array)

Run:

```
vendor/bin/php-sa [path/to/arrays-dir]

```

and answer to fee questions. Without **path/to/arrays-dir** code will be display to STDOUT.

It's "normal" array
-------------------

[](#its-normal-array)

There are some array functions which works with strict arrays:

- `sarray_filter`,
- `sarray_key_exists`,
- `sarray_keys`,
- `sarray_search`,
- `sarray_values`.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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

Unknown

Total

1

Last Release

2343d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9dbae32495a7944e5369005d48c1c687c1ed9a965c6d24cfe65bff54ad3ce6f0?d=identicon)[d0niek](/maintainers/d0niek)

---

Top Contributors

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

---

Tags

arraycollectionsmapphpstrictstrict-typesvectorarrayvectormapcollectionsstrictstrict types

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/extalion-php-strict-array/health.svg)

```
[![Health](https://phpackages.com/badges/extalion-php-strict-array/health.svg)](https://phpackages.com/packages/extalion-php-strict-array)
```

###  Alternatives

[doctrine/collections

PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.

6.0k411.1M1.2k](/packages/doctrine-collections)[aimeos/map

Easy and elegant handling of PHP arrays as array-like collection objects similar to jQuery and Laravel Collections

4.2k412.9k11](/packages/aimeos-map)[dusank/knapsack

Collection library for PHP

5351.0M25](/packages/dusank-knapsack)[consistence/consistence

Consistence - consistent approach and additions to PHP's functionality

1831.1M18](/packages/consistence-consistence)[graze/data-structure

Data collections and containers

12287.4k8](/packages/graze-data-structure)[malarzm/collections

Various implementations of Doctrine's Collection interface

2368.1k](/packages/malarzm-collections)

PHPackages © 2026

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