em is a complete PHP development environment that runs entirely in your browser or as a desktop application. It compiles PHP to WebAssembly, providing a sandboxed environment where you can write, test, and run PHP code without any server setup.
No installation required - just click and start coding PHP instantly!
- Full-featured code editor with syntax highlighting
- Multiple PHP versions (8.0, 8.1, 8.2, 8.3, 8.4, master)
- Real-time code execution
- Built-in virtual browser for testing web applications
- Complete file system simulation in memory
- Import/export projects as ZIP files
- Persistent storage across sessions
- Directory operations and file management
- Load projects directly from GitHub repositories
- Import from GitHub Gists
- Secret Token Support (avoids REST api limits)
- SQLite database support
- ZIP archive handling
- Image processing (GD, JPEG, PNG)
- XML/DOM manipulation
- Compression (zlib, bz2)
- And many more PHP extensions
Download the desktop version for offline development (uses electron):
| OS | Arch | Format | Link |
|---|---|---|---|
| Linux | x64 | AppImage | Download |
| Linux | arm64 | AppImage | Download |
| Linux | x64 | zip | Download |
| Linux | arm64 | zip | Download |
| MacOS | x64 | dmg | Download |
| MacOS | arm64 | dmg | Download |
| MacOS | x64 | zip | Download |
| MacOS | arm64 | zip | Download |
| Windows | x64 | portable | Download |
| Windows | x64 | setup | Download |
| Windows | x64 | zip | Download |
Note: Electron builds need to be started with --no-sandbox to function properly; It's a good idea to create a launcher for your operating system that automatically starts the application with --no-sanbbox. This is an annoyance and limitation of electron-builder that I can't find a gracious way around ...
- Perfect for PHP tutorials and learning
- No need to set up XAMPP, WAMP, or local servers
- Safe sandbox environment for experimentation
- Quickly test PHP concepts and algorithms
- Test across multiple PHP versions instantly
- Portable development environment
- Test code behavior in isolation
- Debug without affecting your main system
- Open em in your browser
- Choose your PHP version from the dropdown
- Write your PHP code in the editor
- Click "Run Code" or press
Ctrl+Enter - See the output instantly
Use em as a build pipeline for your PHP WebAssembly projects:
- uses: krakjoe/em@develop
with:
EM_PHP_DIR: ./php-src
bake: allSee ACTION.md for detailed usage instructions.
Embed PHP execution in your JavaScript applications:
// Execute PHP code
const result = Module.invoke('<?php echo "Hello from PHP!"; ?>');
console.log(result); // "Hello from PHP!"
// Work with the virtual file system
Module.vfs.put('/data.txt', new TextEncoder().encode('Hello World'));
const content = Module.vfs.get('/data.txt');- Run PHP web applications in a simulated browser environment
- Test forms, sessions, and HTTP requests
- Debug web applications without a real server
- New File/Folder: Create and organize your project structure
- Import/Export VFS: Upload/Download and persist with native, optionally compressed, and random access memory streams.
- Import/Export ZIP: Upload/Download from external sources
- GitHub Import: Load repositories and gists directly
While ZIP is a perfectly cromulent and portable format, it's rather wasteful, and does not lend itself to very fast reading or writing, so we could not base persistence on Zip.
Instead em implements streaming the vfs as a contiguous buffer, the buffer will use compression where zlib is available, is randomly accessible, produces smaller outputs than zip and is much more suitable for persistence.
So that you may create images outside of the ide, we provide php-em-vfs.js, this may be used to create and extract images from and into local directories.
To create /tmp/my.vfsi with the content of /path/to/my/files:
php-em-vfs.js --mode create --in /path/to/my/files --out /tmp/my.vfsi
To create /tmp/my.vfsi with the contents of /path/to/my/files where the root directory in the image is desired to be files:
php-em-vfs.js --mode create --in /path/to/my/files --out /tmp/my.vfsi --strip 2
To extra /tmp/my.vfsi into /tmp/vfsi.my (output directory must exist):
php-em-vfs.js --mode extract --in /tmp/my.vfsi --out /tmp/vfsi.my
Test your code across different PHP versions to ensure compatibility:
- PHP 8.0 through 8.4
- Latest development version (master branch)
em is built on several key technologies:
- WebAssembly: Runs PHP natively in the browser
- Emscripten: Compiles PHP C code to WebAssembly
- Virtual File System: Complete POSIX-like file operations
- Service Workers: Enables the virtual browser functionality
- IndexedDB/FileSystem API: Provides persistent storage
We welcome contributions! Whether you're:
- π Reporting bugs
- π‘ Suggesting features
- π Improving documentation
- π§ Contributing code
Check out our issues to get started.
This project is licensed under the PHP License 3.01 - see the LICENSE file for details.
- PHP Core Team for the amazing PHP language
- Emscripten team for WebAssembly tooling
- All contributors who help make em better
Start coding PHP in your browser today! β Launch em