130 lines
3.1 KiB
Markdown
130 lines
3.1 KiB
Markdown
|
|
# 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)
|
|
|
|
* **Windows users:** Use [WSL](https://learn.microsoft.com/en-us/windows/wsl/install) or Docker Desktop.
|
|
*Note: Native Windows support is planned for an upcoming releases (in a few months.).*
|
|
|
|
* **macOS users:** Use an emulator like [UTM](https://mac.getutm.app/) or run the project using Docker.
|
|
*Note: Native macOS support is coming in a few months.*
|
|
|
|
* **Modern web browser** with WebRTC support (e.g., 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.
|
|
|
|
```bash
|
|
# 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
|
|
|
|
```bash
|
|
git clone https://github.com/PHP-WebRTC/examples.git
|
|
```
|
|
|
|
#### 2. Install System Dependencies
|
|
|
|
```bash
|
|
# 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
|
|
|
|
```bash
|
|
cd examples/[example_directory] # e.g. cd examples/echo
|
|
|
|
# Install PHP dependencies using Composer
|
|
composer install
|
|
```
|
|
|
|
#### 4. Start the Signaling Server
|
|
|
|
```bash
|
|
php server.php
|
|
```
|
|
|
|
#### 5. Serve the Client via PHP's Built-In Web Server
|
|
|
|
```bash
|
|
php -S localhost:8000
|
|
```
|
|
|
|
Now, open your browser and go to:
|
|
👉 **https://localhost:8000**
|
|
|
|
---
|
|
|
|
## Screenshots
|
|
|
|
### Main page
|
|

|
|
|
|
### Echo test
|
|
|
|
[](https://www.youtube.com/watch?v=A3cMO5wfkfU)
|
|
|
|
**Youtube: https://www.youtube.com/watch?v=A3cMO5wfkfU**
|
|
|
|
> **Please note:** Additional examples and updates will be added in the coming weeks.
|
|
|
|
|
|
---
|
|
|
|
## 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](https://www.aminyazdanpanah.com)
|
|
- Email: [github@aminyazdanpanah.com](mailto:github@aminyazdanpanah.com)
|
|
|
|
- **Sana Moniri**
|
|
- GtiHub: [sanamoniri](https://github.com/sanamoniri)
|
|
|
|
---
|
|
|
|
## Reporting Issues
|
|
|
|
Found a bug? Please report it on our [issues](https://github.com/php-webrtc/webrtc/issues).
|
|
|
|
---
|
|
|
|
## License
|
|
|
|
BSD 3-Clause License. See [LICENSE](LICENSE) for details.
|