This package holds some custom PHP types such as Array and String. It provides functionalities similar to array and string in Javascript.
Require this package
composer require israelalagbe/php-custom-types
You can use it the following way
use IsraelAlagbe\CustomTypes\_Array;
$items = new _Array([1,2]); // or _Array(1, 2)
$items->push(4); // [1,2,4]
$items->map(function($item) {
return $item * 2;
}); // [2, 4, 8]
echo $items;
//To get the original array, you can use
print_r($items->toArray()); // [2, 4, 8]
If you forked this package, you can test using the command below.
composer test
MIT