PHPackages                             typedarray/typedarray - 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. typedarray/typedarray

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

typedarray/typedarray
=====================

Simple typed Array abstraction class.

1.0.2(1y ago)27MITPHPPHP &gt;=8.0

Since Dec 11Pushed 1y ago1 watchersCompare

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

READMEChangelog (2)DependenciesVersions (5)Used By (0)

Simple Typed Array
==================

[](#simple-typed-array)

Simple abstract class for typed Arrays with a set of classes for the different basic types.

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

[](#installation)

### Composer

[](#composer)

To install the library, execute the following code:

```
composer require typedarray/typedarray

```

### Manual

[](#manual)

Download the library from

Include all the files from the "installation path/src"

```
function autoload($path) {
    $items = glob($path . DIRECTORY_SEPARATOR . "*");

    foreach($items as $item) {
        $isPhp = pathinfo($item) ["extension"] === "php";

        if (is_file($item) && $isPhp) {
            require_once $item;
        } elseif (is_dir($item)) {
            autoload($item);
        }
    }
}

autoload($installation_path . DIRECTORY_SEPARATOR . 'src');

```

Examples of Usage
-----------------

[](#examples-of-usage)

Are you sick of typing your arrays with comments that are working in your IDEs, but your code still allows mixed values?

Here are some examples demonstrating how to use the library:

### Define a Custom Typed Array

[](#define-a-custom-typed-array)

Here is a simple solution to this problem.

Instead of typing your arrays like:

```
/* @var int[] */
$my_int_array = [];
```

You can select a default typed array. For example:

```
