strictify / lazy
Installs: 401
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/strictify/lazy
Requires
- php: ^8.0
Requires (Dev)
- phpunit/phpunit: ^9.5
- roave/security-advisories: dev-latest
- vimeo/psalm: ^5
This package is auto-updated.
Last update: 2025-10-04 15:32:59 UTC
README
Add laziness to data evaluation
Requirements
PHP ^8.0
Installation
composer require strictify/lazy
Usage:
use Strictify\Lazy\LazyValue; function someSlowFunction() { sleep(5); return 42; } // assigning the value does nothing $lazy = new LazyValue(fn() => someSlowFunction()); // waits 5 seconds, returns 42 $lazy->getValue(); // immediately returns 42 $lazy->getValue();
Full static analysis; psalm will always know the correct type.
More real cases soon.