{"id":21616626,"url":"https://github.com/nesk/network.js-php-server","last_synced_at":"2026-04-20T05:02:19.499Z","repository":{"id":148103009,"uuid":"42511984","full_name":"nesk/network.js-php-server","owner":"nesk","description":"A PHP server implementation for Network.js","archived":false,"fork":false,"pushed_at":"2015-09-24T11:22:46.000Z","size":152,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-24T20:48:59.889Z","etag":null,"topics":[],"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/nesk.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":"2015-09-15T10:39:24.000Z","updated_at":"2022-09-03T12:30:58.000Z","dependencies_parsed_at":"2023-04-08T09:18:04.318Z","dependency_job_id":null,"html_url":"https://github.com/nesk/network.js-php-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nesk%2Fnetwork.js-php-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nesk%2Fnetwork.js-php-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nesk%2Fnetwork.js-php-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nesk%2Fnetwork.js-php-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nesk","download_url":"https://codeload.github.com/nesk/network.js-php-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244267475,"owners_count":20425835,"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":[],"created_at":"2024-11-24T22:14:54.884Z","updated_at":"2026-04-20T05:02:14.469Z","avatar_url":"https://github.com/nesk.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP server for Network.js\n\nA server implementation written in PHP for Network.js. Available as a standalone archive or as a library based on [the PSR-7 standard](http://www.php-fig.org/psr/psr-7/).\n\n## Usage\n\n### As a standalone project\n\n[Download an archive](https://github.com/network-js/php-server/archive/master.zip) and extract it wherever you want on your web server. Then, in the client configuration, specify the path to the [index.php](index.php) file:\n\n```js\nnew Network({\n    endpoint: 'path/to/the/server/directory/index.php'\n});\n```\n\n### As a library\n\nSince this project is based on [the PSR-7 standard](http://www.php-fig.org/psr/psr-7/), you can use it in “vanilla PHP”, Symfony, Laravel, etc…\n\n```shell\ncomposer require network-js/php-server\n```\n\nYou can use the `NetworkJs\\ResponseFactory` class to generate responses:\n\n```php\nuse NetworkJs\\ResponseFactory;\n```\n\nThe `fromRequest` method returns a response based on the \"module\" and \"size\" query parameters written in the PSR-7 request you provide (if you omit this parameter, a default request will be generated).\nIt is also recommended to provide a maximum size (in bytes) for the download response, it avoids to overload your server if a client asks for a very big size.\n\n```php\n$response = ResponseFactory::fromRequest(\n    $request, // An object implementing `Psr\\Http\\Message\\ServerRequestInterface`\n    1024 * 1024 * 512 // A maximum size of 512MB\n);\n```\n\nThe `fromValues` method is nearly the same as `fromRequest` but you manually provide the module name (`latency`, `upload` or `download`) and the size (in bytes).\n\n```php\n$response = ResponseFactory::fromValues(\n    'download',\n    1024 * 1024 * 50, // A size of 50MB\n    1024 * 1024 * 512 // A maximum size of 512MB\n);\n```\n\nThe returned object is a child instance of the `NetworkJs\\Response` class, which provides a `send` method.\n\n```php\n$response-\u003esend();\n```\n\n### Sidenote for non-Apache users\n\nThis server implementation is configured to disable GZIP compression when Apache is used but not with other web servers. You __MUST__ disable this feature for the endpoints used by Network.js or the measures will fail!\n\n## License\n\nThis project is licensed under [the MIT license](LICENSE), check [TLDRLegal for details](https://tldrlegal.com/license/mit-license).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnesk%2Fnetwork.js-php-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnesk%2Fnetwork.js-php-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnesk%2Fnetwork.js-php-server/lists"}