{"id":33985524,"url":"https://github.com/normal-ai/thinkphp6-async-task","last_synced_at":"2025-12-13T04:57:00.583Z","repository":{"id":64888497,"uuid":"579075881","full_name":"normal-ai/thinkphp6-async-task","owner":"normal-ai","description":"基于workerman的thinkphp6异步任务模型。","archived":false,"fork":false,"pushed_at":"2024-04-03T16:16:39.000Z","size":573,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-10T11:58:15.687Z","etag":null,"topics":["async-task","thinkphp","thinkphp6","thinkphp6-async-task","thinkphp6-workerman","tp6-async-task","workerman","workerman-async-task"],"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/normal-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-12-16T15:43:30.000Z","updated_at":"2024-05-04T03:08:21.000Z","dependencies_parsed_at":"2024-04-22T04:33:35.164Z","dependency_job_id":"18b6f4f3-afe8-4ea0-98c9-67829441c176","html_url":"https://github.com/normal-ai/thinkphp6-async-task","commit_stats":{"total_commits":16,"total_committers":2,"mean_commits":8.0,"dds":0.125,"last_synced_commit":"2c1e58857d50f1a0a2c9b299db4f5b1d54a6a2ba"},"previous_names":["normal-ai/thinkphp6-async-task"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/normal-ai/thinkphp6-async-task","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/normal-ai%2Fthinkphp6-async-task","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/normal-ai%2Fthinkphp6-async-task/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/normal-ai%2Fthinkphp6-async-task/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/normal-ai%2Fthinkphp6-async-task/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/normal-ai","download_url":"https://codeload.github.com/normal-ai/thinkphp6-async-task/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/normal-ai%2Fthinkphp6-async-task/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27700390,"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-12-13T02:00:09.769Z","response_time":147,"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-task","thinkphp","thinkphp6","thinkphp6-async-task","thinkphp6-workerman","tp6-async-task","workerman","workerman-async-task"],"created_at":"2025-12-13T04:56:58.084Z","updated_at":"2025-12-13T04:57:00.572Z","avatar_url":"https://github.com/normal-ai.png","language":"PHP","readme":"# thinkphp6-async-task\n\n## 介绍\n基于workerman的thinkphp6异步任务模型\n\n## 安装\n~~~\ncomposer require cathy/thinkphp6-async-task\n~~~\n\n## 使用\n\u003e 创建异步任务类及方法\n~~~\n\u003c?php\nnamespace app\\tasks;\n\nuse cathy\\AsyncTask\\main\\AsyncTaskSynchronizer;\n\nclass DemoAsyncTasks\n{\n    public function demo($data, AsyncTaskSynchronizer $taskSynchronizer) {\n        for($i = 1;$i \u003c= 100; $i++) {\n            $taskSynchronizer-\u003eupdate($i);\n            sleep(1);\n        }\n        $taskSynchronizer-\u003edone(['message'=\u003e'Hi!'.$data['name']]);\n    }\n}\n~~~\n\u003e 执行异步任务\n~~~\n$asyncTaskProducer = new AsyncTaskProducer();\ntry {\n    $taskKey = $asyncTaskProducer-\u003eexecute(\n        new AsyncTask(DemoAsyncTasks::class, 'demo', ['name'=\u003e'cathy'])\n    );\n    echo $taskKey;\n} catch (ExecAsyncTaskException|InvalidAsyncTaskException $e) {\n    echo $e-\u003egetMessage();\n}\n~~~\n\u003e 获取任务进度\n~~~\ntry {\n    $taskKey = ''; // 执行异步任务得到的taskKey\n    echo json_encode(AsyncTaskAcquirer::get($taskKey));\n} catch (Exception $e) {\n    echo $e-\u003egetMessage();\n}\n~~~","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnormal-ai%2Fthinkphp6-async-task","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnormal-ai%2Fthinkphp6-async-task","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnormal-ai%2Fthinkphp6-async-task/lists"}