2017-25 © Pedro Peláez
 

library typed-arrays

Typed arrays in PHP.

image

andrewcarteruk/typed-arrays

Typed arrays in PHP.

  • Friday, January 22, 2016
  • by AndrewCarterUK
  • Repository
  • 3 Watchers
  • 39 Stars
  • 20 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Typed Arrays

Build Status Code Coverage Scrutinizer Code Quality Latest Stable Version Total Downloads License, (*1)

Typed arrays in PHP., (*2)

By AndrewCarterUK (Twitter), (*3)

Install

Install using Composer., (*4)

composer require andrewcarteruk/typed-arrays ^0.2

Warning

These are objects that act like arrays, they are not native PHP arrays and will not pass an is_array() test., (*5)

As they are objects, unlike PHP arrays, they are always passed by reference., (*6)

Example Usage

use TypedArray\StringArray;

$stringArray = new StringArray(['Hello, World!', 'foo' => 'bar']);
// Or, $stringArray = new StringArray();

try {
    $stringArray[] = 1;
} catch (\InvalidArgumentException $exception) {
    echo $exception->getMessage() . PHP_EOL;
}
use App\Farm\Chicken;
use TypedArray\InstanceArray;

$chickenArray = new InstanceArray(Chicken::class, [new Chicken('Bob')]);

$chickenArray[] = new Chicken('Tony');
$chickenArray['foo'] = new Chicken('Alice');

try {
    $chickenArray[] = 1;
} catch (\InvalidArgumentException $exception) {
    echo $exception->getMessage() . PHP_EOL;
}

Available Types

ArrayArray, BoolArray, CallableArray, FloatArray, InstanceArray($classPath), IntArray, NumericArray, ObjectArray, ResourceArray, ScalarArray, StringArray., (*7)

The Versions

22/01 2016

dev-master

9999999-dev http://github.com/AndrewCarterUK/TypedArrays

Typed arrays in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

array arrays class object string typed double

22/01 2016

dev-moved-iteration-tes

dev-moved-iteration-tes http://github.com/AndrewCarterUK/TypedArrays

Typed arrays in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

array arrays class object string typed double

22/01 2016

v0.2

0.2.0.0 http://github.com/AndrewCarterUK/TypedArrays

Typed arrays in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

array arrays class object string typed double

22/01 2016

v0.1

0.1.0.0 http://github.com/AndrewCarterUK/TypedArrays

Typed arrays in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

array arrays class object string typed double