2.4 KiB
2.4 KiB
PHP WebRTC Examples Collection
A collection of WebRTC examples with PHP-based signaling backends.
Requirements
- PHP 8.4 or higher
- Linux environment (required for manual setup)
- Modern web browser with WebRTC support (Chrome, Firefox, Edge, Safari)
- HTTPS connection (required by WebRTC for secure contexts)
Running the Examples
Option 1: Run with Docker (Recommended)
A preconfigured Docker setup is provided for easy local development with HTTPS support.
# Build and start the Docker container
docker-compose up -d
Once running, access the examples at:
👉 https://localhost
The Docker environment automatically generates a self-signed certificate for HTTPS access.
Option 2: Manual Setup (Linux Only)
⚠️ Manual setup is currently supported only on Linux systems.
1. Clone the Repository
git clone https://github.com/PHP-WebRTC/examples.git
2. Install System Dependencies
# Make the installer executable and run it
cd examples
chmod +x install_deps.sh
./scripts/install_deps.sh
you may need to run as root if you don't have permission to install deps sudo ./scripts/install_deps.sh
3. Navigate to an Example and Install PHP Dependencies
cd examples/[example_directory] # e.g. cd examples/echo
# Install PHP dependencies using Composer
composer install
4. Start the Signaling Server
php server.php
5. Serve the Client via PHP's Built-In Web Server
php -S localhost:8000
Now, open your browser and go to:
👉 https://localhost:8000
Important Notes
- WebRTC requires a secure (HTTPS) context. You may need to accept your browser's warning about self-signed certificates during local development.
- Be sure to grant access to your camera and microphone when prompted.
- If something isn't working, check the browser console for errors or permission issues.
Credits
Authors
-
Amin Yazdanpanah
- Website: aminyazdanpanah.com
- Email: github@aminyazdanpanah.com
-
Sana Moniri
- GtiHub: sanamoniri
Reporting Issues
Found a bug? Please report it on our issues.
License
BSD 3-Clause License. See LICENSE for details.