{"id":28560118,"url":"https://github.com/capsulescodes/browser-php","last_synced_at":"2025-06-10T09:07:35.077Z","repository":{"id":222653611,"uuid":"756889998","full_name":"capsulescodes/browser-php","owner":"capsulescodes","description":"PHP CLI and Web server on browser","archived":false,"fork":false,"pushed_at":"2025-06-01T22:32:23.000Z","size":70,"stargazers_count":25,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-02T07:33:27.893Z","etag":null,"topics":["browser","nodejs","php"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/capsulescodes.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,"publiccode":null,"codemeta":null}},"created_at":"2024-02-13T14:06:54.000Z","updated_at":"2025-06-01T22:31:52.000Z","dependencies_parsed_at":"2024-07-09T18:31:26.691Z","dependency_job_id":null,"html_url":"https://github.com/capsulescodes/browser-php","commit_stats":null,"previous_names":["capsulescodes/browser-php"],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capsulescodes%2Fbrowser-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capsulescodes%2Fbrowser-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capsulescodes%2Fbrowser-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capsulescodes%2Fbrowser-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/capsulescodes","download_url":"https://codeload.github.com/capsulescodes/browser-php/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capsulescodes%2Fbrowser-php/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259043770,"owners_count":22797163,"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":["browser","nodejs","php"],"created_at":"2025-06-10T09:07:33.768Z","updated_at":"2025-06-10T09:07:35.068Z","avatar_url":"https://github.com/capsulescodes.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003cp align=\"center\"\u003e\u003cimg src=\"art/capsules-browser-php-image.svg\" width=\"400px\" height=\"265px\" alt=\"Browser PHP\" /\u003e\u003c/p\u003e\n\nRun any PHP stuff within your browser.\n\nThe Browser PHP package offers a collection of commands for running PHP from the Node CLI or for launching a PHP server from Node. Perfect for running a Laravel project in CodeSandbox, for example.\n\n\u003cbr\u003e\n\n [This article](https://capsules.codes/en/blog/fyi/en-fyi-run-laravel-on-your-browser-with-browser-php) provides an in-depth exploration of the package.\n\n\u003cbr\u003e\n\n## Installation\n\n```bash\nnpm install --save-dev @capsulescodes/browser-php\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n## Usage\n\nThis package gives access to three binaries. `php-cli` and `php-server` from `node_modules`, `composer` from `vendor`.\n\n\u003cbr\u003e\n\n### PHP\n```\nnode node_modules/.bin/php-cli\n```\n\n\u003cbr\u003e\n\nOr add `script` in `package.json`\n```\n\"scripts\" : {\n    \"php\" : \"php-cli\"\n},\n```\n\n\u003cbr\u003e\n\nExample\n```\nnpm run php -r \"echo 'Hello Browser PHP World!';\"\n\n\n\u003e Hello Browser PHP World!\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n### Serve\n```\nnode node_modules/.bin/php-server\n```\n\n\u003cbr\u003e\n\nOr add `script` in `package.json`\n```\n\"scripts\" : {\n    \"serve\" : \"php-server\"\n},\n```\n\n\u003cbr\u003e\n\nExample\n```\nnpm run serve\n\n\n\u003e PHP server is listening on url http://localhost:2222\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n### Composer\n```\nnode node_modules/.bin/php vendor/bin/composer\n```\n\n\u003cbr\u003e\n\nOr add `script` in `package.json`\n```\n\"scripts\" : {\n    \"composer\": \"php-cli vendor/bin/composer\"\n},\n```\n\n\u003cbr\u003e\n\nExample\n```\nnpm run composer\n\n\u003e    ______\n\u003e   / ____/___  ____ ___  ____  ____  ________  _____\n\u003e  / /   / __ \\/ __ `__ \\/ __ \\/ __ \\/ ___/ _ \\/ ___/\n\u003e / /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /\n\u003e \\____/\\____/_/ /_/ /_/ .___/\\____/____/\\___/_/\n\u003e                     /_/\n\u003e Composer version 2.7.7 2024-06-10 22:11:12\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n## Configuration\n\nThe scripts can be configured with environment variables\n\n- `BROWSER_PHP_VERSION` : The PHP version you need | default : `8.2`\n\n- `BROWSER_PHP_COMPOSER_VERSION` : The Composer executable version | default : `2.7.7`\n- `BROWSER_PHP_COMPOSER_PATH` : The Composer executable path | default : `vendor/bin`\n- `BROWSER_PHP_COMPOSER_NAME` : The Composer executable name | default : `composer`\n\n- `BROWSER_PHP_SERVER_HOST` : The host name you need | default : `http://localhost`\n- `BROWSER_PHP_SERVER_PORT` : The port you need | default : `2222`\n- `BROWSER_PHP_SERVER_PATH` : The directory path you need | default : `public`\n- `BROWSER_PHP_SERVER_DEBUG` : The debug mode you need | default : `false`\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\nPlease make sure to update tests as appropriate.\n\n## Credits\n\n- [Capsules Codes](https://github.com/capsulescodes)\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapsulescodes%2Fbrowser-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcapsulescodes%2Fbrowser-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapsulescodes%2Fbrowser-php/lists"}