2017 © Pedro Peláez
 

library sloth

image

mkoubik/sloth

  • Saturday, February 8, 2014
  • by mkoubik
  • Repository
  • 2 Watchers
  • 10 Stars
  • 124 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Sloth

CI codecov, (*1)

Installation

composer require mkoubik/sloth, (*2)

Usage

<?php

use Sloth\LazyString;

$string = new LazyString(fn () => 'Hello world!');

echo $string; // callback is called at this point
echo $string; // callback is not called any more
<?php

use Sloth\LazyIterator;

$iterator = new LazyIterator(fn () => range(1, 9999));

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

echo count($iterator); // works too
<?php

use Sloth\LazyAccessor;

$person = new LazyAccessor(fn () => 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');

The Versions

08/02 2014

dev-master

9999999-dev

  Sources   Download

The Requires

  • php >=5.3.0

 

The Development Requires

by Matej Koubik