Skip to content

israelalagbe/php-custom-types

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Custom PHP Types

This package holds some custom PHP types such as Array and String. It provides functionalities similar to array and string in Javascript.

Installation

Require this package

composer require israelalagbe/php-custom-types

Array Types

Basic Usage

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]

Testing

If you forked this package, you can test using the command below.

composer test

License

MIT

About

Custom types for PHP similar to Array and String in JavaScript

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages