/php-foreachable

A trait to create custom PHP DataSets/Collections faster

Primary LanguagePHP

php-foreachable

A trait to create custom PHP DataSets/Collections faster

📦 Install it with composer

composer config repositories.turbolabit/php-foreachable git https://github.com/TurboLabIt/php-foreachable.git
composer require turbolabit/php-foreachable:dev-main

🔁 A base for your DataSet/Collections

Use it to quickly create collections of objects. You can then iterate over it.

<?php
 use TurboLabIt\Foreachable\Foreachable;
 
 class Listing implements \Iterator, \Countable, \ArrayAccess
 {
    use Foreachable;
 }
 ?>
 
 
 <?php
 $collListing = new Listing();
 foreach($collListing as $oneItem) {
 
    // ..
 }
 ?>

See: MyDataSet | Usage

🧪 Test it

git clone git@github.com:TurboLabIt/php-foreachable.git
cd php-foreachable
clear && bash script/test_runner.sh