phower / arrays
Array based classes to handle collections, stacks and queues in PHP.
Requires
- php: ^5.6 || ^7.0
Requires (Dev)
- phpunit/phpunit: ^5.2
- squizlabs/php_codesniffer: ^2.5
- symfony/var-dumper: ^3.0
This package is auto-updated.
Last update: 2024-12-10 05:22:48 UTC
README
Array based classes to handle collections, stacks and queues in PHP.
Requirements
Phower Arrays requires:
Instalation
Add Phower Arrays to any PHP project using Composer:
composer require phower/arrays
Getting Started
Collections
Collections is the base concept of this package. Each collection wraps an array into a class with methods to handle its elements in a normalized way. Both concrete and abstract classes are provided.
// index.php require('path/to/vendor/autoload.php'); use Phower\Arrays\Collection; $collection = new Collection();
Please review Collection Interface for more details on available methods.
Stacks
Stacks are collections where elements are always added to the top of the internal array. This strategy allows a LIFO (Last In-First Out) handling.
use Phower\Arrays\Stack; $stack = new Stack();
Please review Stack Interface for more details on available methods.
Queues
Queues are collections with the ability to enqueue/dequeue elements. While enqueue is similiar to add method, dequeue always remove the returned element from the queue.
use Phower\Arrays\Queue; $queue = new Queue();
Please review Queue Interface for more details on available methods.
Running Tests
Tests are available in a separated namespace and can run with PHPUnit in the command line:
vendor/bin/phpunit
Coding Standards
Phower code is written under PSR-2 coding style standard. To enforce that CodeSniffer tools are also provided and can run as:
vendor/bin/phpcs
Reporting Issues
In case you find issues with this code please open a ticket in Github Issues at https://github.com/phower/arrays/issues.
Contributors
Open Source is made of contribuition. If you want to contribute to Phower please follow these steps:
- Fork latest version into your own repository.
- Write your changes or additions and commit them.
- Follow PSR-2 coding style standard.
- Make sure you have unit tests with full coverage to your changes.
- Go to Github Pull Requests at https://github.com/phower/arrays/pulls and create a new request.
Thank you!
Changes and Versioning
All relevant changes on this code are logged in a separated log file.
Version numbers follow recommendations from Semantic Versioning.
License
Phower code is maintained under The MIT License.