alecrabbit / accessories
This package is abandoned and no longer maintained.
The author suggests using the alecrabbit/php-accessories package instead.
PHP Accessories: Classes etc.
0.2.5-RC3
2019-01-31 14:49 UTC
Requires
- php: >=7.2
- alecrabbit/php-helpers: ^0.2
Requires (Dev)
- nunomaduro/collision: ^2.1
- phpunit/phpunit: ^7.5
- symfony/var-dumper: ^4.2
README
project is moved to alecrabbit/php-accessories
will be deleted soon
PHP accessories
Installation
composer require alecrabbit/accessories
Usage
see examples
Features
- G - class containing generator functions
$r1 = G::range(1, 3); $r2 = G::rewindableRange(1, 3);
- Circular - helper class to get values in a circle
$c = new Circular([1, 2, 3]); $value = $c(); // invoke $value = $c->getElement(); // method
- Rewindable - rewindable generator helper class
$r = new Rewindable($generatorFunction); iterator_to_array($r); $r->rewind();
- Pretty - string formatter, e.g. bytes and time
Pretty::bytes(10584760, 'mb'); // string(7) "10.09MB" Pretty::time(0.214); // string(5) "214ms" Pretty::precent(0.214); // // string(6) "21.40%"
- MemoryUsage - memory usage :)
$report = MemoryUsage::report('mb'); echo $report . PHP_EOL;