{"id":20441714,"url":"https://github.com/mix-php/http-server","last_synced_at":"2026-03-01T18:02:19.360Z","repository":{"id":57017778,"uuid":"168302013","full_name":"mix-php/http-server","owner":"mix-php","description":"Http server library based on Swoole coroutine, following PSR-7 / PSR-15 standard","archived":false,"fork":false,"pushed_at":"2022-04-15T15:35:58.000Z","size":68,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-18T08:11:08.199Z","etag":null,"topics":["http","mix","server"],"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/mix-php.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}},"created_at":"2019-01-30T07:51:57.000Z","updated_at":"2024-12-16T15:01:17.000Z","dependencies_parsed_at":"2022-08-22T12:00:28.425Z","dependency_job_id":null,"html_url":"https://github.com/mix-php/http-server","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/mix-php/http-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mix-php%2Fhttp-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mix-php%2Fhttp-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mix-php%2Fhttp-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mix-php%2Fhttp-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mix-php","download_url":"https://codeload.github.com/mix-php/http-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mix-php%2Fhttp-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29977966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T16:35:47.903Z","status":"ssl_error","status_checked_at":"2026-03-01T16:35:44.899Z","response_time":124,"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":["http","mix","server"],"created_at":"2024-11-15T09:34:22.209Z","updated_at":"2026-03-01T18:02:19.344Z","avatar_url":"https://github.com/mix-php.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Mix Http Server\n\n基于 Swoole 协程的 http server 类库，遵循 PSR-7 / PSR-15 标准\n\n## Usage\n\n安装：\n\n- Swoole \u003e= 4.4.4: https://wiki.swoole.com/#/environment\n\n```\ncomposer require mix/http-server\n```\n\n服务器：\n\n- 使用 `handle` 配置\n\n\u003e '/' 将匹配所有路由\n\n```\n$server = new Mix\\Http\\Server\\Server('0.0.0.0', 9596, false, false);\n$server-\u003ehandle('/', function (\\Mix\\Http\\Message\\ServerRequest $request, \\Mix\\Http\\Message\\Response $response) {\n    $response-\u003ewithBody(new \\Mix\\Http\\Message\\Stream\\ContentStream('hello, world!'));\n    $response-\u003esend();\n});\n$server-\u003estart();\n```\n\n- 实现 `HandlerInterface` 接口\n\n```\nclass Router implements \\Mix\\Http\\Server\\ServerHandlerInterface\n{\n    public function handleHTTP(ServerRequest $request, Response $response) {\n        // ...\n    }\n}\n\n$handler = new Router();\n\n$server = new Mix\\Http\\Server\\Server('0.0.0.0', 9596, false, false);\n$server-\u003estart($handler);\n```\n\n中间件：\n\n```\n$process    = function (ServerRequest $request, Response $response) use ($result) {\n    // ...\n    return $response;\n};\n$dispatcher  = new MiddlewareDispatcher($middleware, $process, $request, $response);\n$response    = $dispatcher-\u003edispatch();\n```\n\n## License\n\nApache License Version 2.0, http://www.apache.org/licenses/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmix-php%2Fhttp-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmix-php%2Fhttp-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmix-php%2Fhttp-server/lists"}