An open API service indexing awesome lists of open source software.

https://github.com/mkoubik/sloth


https://github.com/mkoubik/sloth

functional lazy-evaluation php

Last synced: 6 months ago
JSON representation

Awesome Lists containing this project

README

          

Sloth
=====
![CI](https://github.com/mkoubik/sloth/workflows/CI/badge.svg)
[![codecov](https://codecov.io/gh/mkoubik/Sloth/branch/master/graph/badge.svg)](https://codecov.io/gh/mkoubik/Sloth)

Installation
------------
`composer require mkoubik/sloth`

Usage
-----
```php
'Hello world!');

echo $string; // callback is called at this point
echo $string; // callback is not called any more
```

```php
range(1, 9999));

foreach ($iterator as $number) { // callback is called at this point
echo $number . "\n";
}

echo count($iterator); // works too
```

```php
new Person('John Doe'));

echo $person->name; // callback is called at this point

if (isset($person->name)) {
unset($person->name);
}

echo $person->setName('John Doe');
```