https://github.com/alecrabbit/accessories
PHP Accessories
https://github.com/alecrabbit/accessories
Last synced: 4 months ago
JSON representation
PHP Accessories
- Host: GitHub
- URL: https://github.com/alecrabbit/accessories
- Owner: alecrabbit
- License: mit
- Created: 2018-10-09T19:24:23.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-10T15:34:27.000Z (over 6 years ago)
- Last Synced: 2025-01-08T19:11:41.176Z (5 months ago)
- Language: PHP
- Homepage:
- Size: 188 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Abandoned!
project is moved to [alecrabbit/php-accessories](https://github.com/alecrabbit/php-accessories)will be deleted soon
# PHP accessories
[](https://php.net/)
[](https://travis-ci.org/alecrabbit/accessories)
[](https://packagist.org/packages/alecrabbit/accessories)
[](https://scrutinizer-ci.com/g/alecrabbit/accessories/?branch=master)
[](https://scrutinizer-ci.com/g/alecrabbit/accessories/?branch=master)
[](https://packagist.org/packages/alecrabbit/accessories)
[](https://packagist.org/packages/alecrabbit/accessories)
[](https://packagist.org/packages/alecrabbit/accessories)
[](https://packagist.org/packages/alecrabbit/accessories)### Installation
```bash
composer require alecrabbit/accessories
```### Usage
see [examples](https://github.com/alecrabbit/accessories/tree/master/examples)### Features
- G - class containing generator functions
```php
$r1 = G::range(1, 3);
$r2 = G::rewindableRange(1, 3);
```
- Circular - helper class to get values in a circle
```php
$c = new Circular([1, 2, 3]);
$value = $c(); // invoke
$value = $c->getElement(); // method
```
- Rewindable - rewindable generator helper class
```php
$r = new Rewindable($generatorFunction);
iterator_to_array($r);
$r->rewind();
```
- Pretty - string formatter, e.g. bytes and time
```php
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 :)
```php
$report = MemoryUsage::report('mb');
echo $report . PHP_EOL;
```