{"id":20678876,"url":"https://github.com/phpgt/async","last_synced_at":"2025-07-30T17:41:17.586Z","repository":{"id":54907647,"uuid":"311946994","full_name":"phpgt/Async","owner":"phpgt","description":"Promise-based non-blocking operations.","archived":false,"fork":false,"pushed_at":"2025-04-22T13:53:45.000Z","size":118,"stargazers_count":0,"open_issues_count":5,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-18T21:15:55.429Z","etag":null,"topics":["async","async-await","async-programming","asynchronous","asynchronous-programming","php-async","phpgt"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phpgt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["phpgt"]}},"created_at":"2020-11-11T11:13:17.000Z","updated_at":"2025-04-21T14:01:51.000Z","dependencies_parsed_at":"2025-04-19T23:34:29.512Z","dependency_job_id":"42bb4283-0ed6-465e-9ab2-a3785da1168b","html_url":"https://github.com/phpgt/Async","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/phpgt/Async","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FAsync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FAsync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FAsync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FAsync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phpgt","download_url":"https://codeload.github.com/phpgt/Async/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FAsync/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267912168,"owners_count":24164504,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["async","async-await","async-programming","asynchronous","asynchronous-programming","php-async","phpgt"],"created_at":"2024-11-16T21:22:53.333Z","updated_at":"2025-07-30T17:41:17.541Z","avatar_url":"https://github.com/phpgt.png","language":"PHP","readme":"Promise-based non-blocking operations.\n======================================\n\nTo be able to run asynchronous code in PHP, a loop needs to run in the background to observe and dispatch events, and handle the resolution of promises.\n\nThis repository provides the concepts of a `Loop`, different `Timer` implementations and a publish-subscribe model for `Event` objects.\n\n***\n\n\u003ca href=\"https://github.com/PhpGt/Async/actions\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/async-build.svg\" alt=\"PHP.Gt/Async build status\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://app.codacy.com/gh/PhpGt/Async\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/async-quality.svg\" alt=\"PHP.Gt/Async code quality\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://app.codacy.com/gh/PhpGt/Async\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/async-coverage.svg\" alt=\"PHP.Gt/Async code coverage\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://packagist.PhpGt/packages/PhpGt/Async\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/async-version.svg\" alt=\"PHP.Gt/Async latest release\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"http://www.php.gt/Async\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/async-docs.svg\" alt=\"PHP.Gt/Async documentation\" /\u003e\n\u003c/a\u003e\n\nExample usage\n-------------\n\nA loop with three individual timers at 1 second, 5 seconds and 10 seconds.\n\n```php\n$timeAtScriptStart = microtime(true);\n\n$timer = new IndividualTimer();\n$timer-\u003eaddTriggerTime($timeAtScriptStart + 1);\n$timer-\u003eaddTriggerTime($timeAtScriptStart + 5);\n$timer-\u003eaddTriggerTime($timeAtScriptStart + 10);\n\n$timer-\u003eaddCallback(function() use($timeAtScriptStart) {\n\t$now = microtime(true);\n\t$secondsPassed = round($now - $timeAtScriptStart);\n\techo \"Number of seconds passed: $secondsPassed\", PHP_EOL;\n});\n\n$loop = new Loop();\n$loop-\u003eaddTimer($timer);\necho \"Starting...\", PHP_EOL;\n$loop-\u003erun();\n```\n","funding_links":["https://github.com/sponsors/phpgt"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpgt%2Fasync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpgt%2Fasync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpgt%2Fasync/lists"}