{"id":26442739,"url":"https://github.com/ahmard/php-server","last_synced_at":"2025-03-18T10:29:58.022Z","repository":{"id":56942473,"uuid":"403152034","full_name":"Ahmard/php-server","owner":"Ahmard","description":"A small library to help run PHP local server easily and quickly.","archived":false,"fork":false,"pushed_at":"2024-03-26T21:11:11.000Z","size":40,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-20T05:17:19.324Z","etag":null,"topics":["php","php-builtin-server","php-server","php-servers","php8","reactphp-server"],"latest_commit_sha":null,"homepage":"","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/Ahmard.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-09-04T20:39:35.000Z","updated_at":"2024-04-21T21:27:54.000Z","dependencies_parsed_at":"2024-03-26T22:25:50.940Z","dependency_job_id":"71a27347-0612-428d-b764-bb6e248d51b7","html_url":"https://github.com/Ahmard/php-server","commit_stats":{"total_commits":15,"total_committers":3,"mean_commits":5.0,"dds":0.4666666666666667,"last_synced_commit":"01088a8d07a5a050fd6d50a29f4da2916f93eba3"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ahmard%2Fphp-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ahmard%2Fphp-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ahmard%2Fphp-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ahmard%2Fphp-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ahmard","download_url":"https://codeload.github.com/Ahmard/php-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244201487,"owners_count":20415087,"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","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":["php","php-builtin-server","php-server","php-servers","php8","reactphp-server"],"created_at":"2025-03-18T10:29:57.474Z","updated_at":"2025-03-18T10:29:58.009Z","avatar_url":"https://github.com/Ahmard.png","language":"PHP","readme":"# PHP Server\n\nA small library to help run PHP servers easily and quickly.\n\n## Installation\n\n```\ncomposer require ahmard/php-server --dev\n```\n\n## Usage\n\n### PHP Built-In Server\n\nAn implementation of [Built-In Server](https://www.php.net/manual/en/features.commandline.webserver.php)\n\n- With document root\n\n```php\nuse PHPServer\\BuiltIn\\Server;\n\nServer::create('127.0.0.1', '9900')\n    -\u003esetDocumentRoot(__DIR__)\n    -\u003estart()\n    -\u003elogOutputToConsole();\n```\n\n- Route request to single entry file\n\n```php\nuse PHPServer\\BuiltIn\\Server;\n\nServer::create('127.0.0.1', '9900')\n    -\u003esetRouterScript(__DIR__ . 'public/index.php')\n    -\u003estart();\n```\n\n- Provide callable to be invoked when request is received\n\n```php\nuse PHPServer\\BuiltIn\\Server;\n\nServer::create('127.0.0.1', '9900')\n    -\u003eonRequest(fn() =\u003e var_dump('Request Received'))\n    -\u003estart();\n```\n\n- Using multiple workers\n\n```php\nuse PHPServer\\BuiltIn\\Server;\n\nServer::create('127.0.0.1', '9900')\n    -\u003esetWorkers(2)\n    -\u003eonRequest(fn() =\u003e var_dump('Request Received'))\n    -\u003estart();\n```\n\n- Use preferred php version/executable\n\n```php\nuse PHPServer\\BuiltIn\\Server;\n\nServer::create('127.0.0.1', '9900')\n    -\u003esetWorkers(2)\n    -\u003esetPHPExecutable('/usr/bin/php8.0')\n    -\u003eonRequest(fn() =\u003e var_dump('Request Received'))\n    -\u003estart();\n```\n\nEnjoy 😎","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmard%2Fphp-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahmard%2Fphp-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmard%2Fphp-server/lists"}