{"id":37009520,"url":"https://github.com/mkoubik/sloth","last_synced_at":"2026-01-14T00:54:05.044Z","repository":{"id":13941811,"uuid":"16641614","full_name":"mkoubik/sloth","owner":"mkoubik","description":null,"archived":false,"fork":false,"pushed_at":"2020-05-14T19:14:46.000Z","size":22,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-04T01:05:53.276Z","etag":null,"topics":["functional","lazy-evaluation","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mkoubik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-08T11:22:27.000Z","updated_at":"2020-05-14T19:12:56.000Z","dependencies_parsed_at":"2022-09-12T22:30:50.045Z","dependency_job_id":null,"html_url":"https://github.com/mkoubik/sloth","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/mkoubik/sloth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkoubik%2Fsloth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkoubik%2Fsloth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkoubik%2Fsloth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkoubik%2Fsloth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkoubik","download_url":"https://codeload.github.com/mkoubik/sloth/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkoubik%2Fsloth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28407512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T00:40:43.272Z","status":"ssl_error","status_checked_at":"2026-01-14T00:40:42.636Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["functional","lazy-evaluation","php"],"created_at":"2026-01-14T00:54:00.575Z","updated_at":"2026-01-14T00:54:03.565Z","avatar_url":"https://github.com/mkoubik.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Sloth\n=====\n![CI](https://github.com/mkoubik/sloth/workflows/CI/badge.svg)\n[![codecov](https://codecov.io/gh/mkoubik/Sloth/branch/master/graph/badge.svg)](https://codecov.io/gh/mkoubik/Sloth)\n\nInstallation\n------------\n`composer require mkoubik/sloth`\n\nUsage\n-----\n```php\n\u003c?php\n\nuse Sloth\\LazyString;\n\n$string = new LazyString(fn () =\u003e 'Hello world!');\n\necho $string; // callback is called at this point\necho $string; // callback is not called any more\n```\n\n```php\n\u003c?php\n\nuse Sloth\\LazyIterator;\n\n$iterator = new LazyIterator(fn () =\u003e range(1, 9999));\n\nforeach ($iterator as $number) { // callback is called at this point\n    echo $number . \"\\n\";\n}\n\necho count($iterator); // works too\n```\n\n```php\n\u003c?php\n\nuse Sloth\\LazyAccessor;\n\n$person = new LazyAccessor(fn () =\u003e new Person('John Doe'));\n\necho $person-\u003ename; // callback is called at this point\n\nif (isset($person-\u003ename)) {\n    unset($person-\u003ename);\n}\n\necho $person-\u003esetName('John Doe');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkoubik%2Fsloth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkoubik%2Fsloth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkoubik%2Fsloth/lists"}