{"id":20520967,"url":"https://github.com/markjivko/php-sandbox","last_synced_at":"2026-01-30T11:25:32.552Z","repository":{"id":43729616,"uuid":"460528694","full_name":"markjivko/php-sandbox","owner":"markjivko","description":"A tiny PHP sandbox powered by Docker","archived":false,"fork":false,"pushed_at":"2024-10-03T13:59:17.000Z","size":15639,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T08:51:49.268Z","etag":null,"topics":["docker","docker-sandbox","markjivko","pair-programming","php","php-docker","php-interview","php-pair-programming","php-sandbox","phpsandbox","sandbox"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/markjivko.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,"publiccode":null,"codemeta":null}},"created_at":"2022-02-17T17:02:28.000Z","updated_at":"2024-10-03T13:59:21.000Z","dependencies_parsed_at":"2025-01-16T10:26:04.395Z","dependency_job_id":"1d2fd5d3-236c-4821-aa14-e23ef4614640","html_url":"https://github.com/markjivko/php-sandbox","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/markjivko/php-sandbox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markjivko%2Fphp-sandbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markjivko%2Fphp-sandbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markjivko%2Fphp-sandbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markjivko%2Fphp-sandbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markjivko","download_url":"https://codeload.github.com/markjivko/php-sandbox/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markjivko%2Fphp-sandbox/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28911821,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T08:15:08.179Z","status":"ssl_error","status_checked_at":"2026-01-30T08:14:31.507Z","response_time":66,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["docker","docker-sandbox","markjivko","pair-programming","php","php-docker","php-interview","php-pair-programming","php-sandbox","phpsandbox","sandbox"],"created_at":"2024-11-15T22:24:56.264Z","updated_at":"2026-01-30T11:25:32.537Z","avatar_url":"https://github.com/markjivko.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Sandbox\n\n\u003cp align=\"center\"\u003e\n   \u003cimg src=\"https://repository-images.githubusercontent.com/460528694/c41b4a49-c4de-42a4-a8ea-18a7f80bef0e\"/\u003e\n\u003c/p\u003e\n\nThis is a tiny PHP sandbox powered by Docker and [Ace editor](https://github.com/ajaxorg/ace).\n\nUse it for quick tests, pair programming or even online interviews.\n\n\u003ca href=\"https://github.com/markjivko/php-sandbox/blob/main/assets/preview.gif\"\u003e\n   \u003cimg src=\"https://github.com/markjivko/php-sandbox/blob/main/assets/preview.gif?raw=true\"/\u003e\n\u003c/a\u003e\n\n## How to install\n\n1. First install the **LAMP** stack (Apache, MySQL, PHP)\n\n```\nsudo apt-get install lamp-server\n```\n\n2. Clone the repo and link `/var/www/html/` to `src/`\n\n```\ngit clone https://github.com/markjivko/php-sandbox\nsudo rm -rf /var/www/html\nln -s $(pwd)/php-sandbox/src /var/www/html\n```\n\nBy default Apache runs as `www-data:www-data`, which means our php scripts have read-only access to the file system.\n\nThis is by design:\n * The only way to create new pages is to manually add text files in `/var/www/html/code/`\n * In order to make pages editable, manually change their permission to `666` (via cli or UI)\n\nThere is only 1 page available when you install this script, `index.txt`.\n * In order to view it, open a browser at `http://localhost/`\n * Make it editable with `chmod 666 /var/www/html/code/index.txt` or directly from your favorite file explorer\n \nPage names contain only lower-case alpha-numeric characters and dashes (regex `[\\w\\-]{1,128}`).\nPage URLs correspond to text files without the \".txt\" extension.\n\n3. Last but not least, [install **Docker**](https://docs.docker.com/engine/install/ubuntu/)\n\n## Update\n\nUpdating is as simple as running the following commands:\n\n```\ngit add -A\ngit reset --hard\ngit pull\n```\n\nYour work in `/var/www/html/code` is not affected.\n\n## Security\n\nThe project is read-only for Apache with the exception of the text files you selected.\n\nYour text files are executed with PHP only inside of a Docker container.\n\n* the Docker container has read-only access to `/var/ww/html/code` only\n* the script is killed automatically after 3 seconds\n* output is limited to 512KB in length; OOM issues are prevented by forwarding `passthru` output to a custom output buffer handler\n* total code size is limited to 512KB\n\nSearch functionality is missing by design. \nHowever, you could view all pages by running this PHP script:\n\n```php\necho `ls -l /var/www/html/code`;\n```\n\n## Improvements\n\nThe current version uses a basic state machine to check for changes and regularly fetch updates. This model does not prevent race conditions. [diff-match-patch](https://github.com/google/diff-match-patch) is used to optimally update code changes for observers.\n\nWebsockets could be used to make the typing experience more fluid for all parties involved, however this approach is sensitive to network issues (lag, connection losses etc.)\n\nThe app is intentionally bare-bones; there are no users/roles/databases to worry about; you just manually add text files in `/var/www/html/code/` and set their permissions accordingly. \n\n\u003e Simplicity is the ultimate sophistication.\n\u003e \n\u003e -- Leonardo Da Vinci\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkjivko%2Fphp-sandbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkjivko%2Fphp-sandbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkjivko%2Fphp-sandbox/lists"}