mpyw / php-hyper-builtin-server
Reverse proxy for PHP built-in server which supports multiprocessing and TLS/SSL encryption
Installs: 82 998
Dependents: 1
Suggesters: 0
Security: 0
Stars: 106
Watchers: 8
Forks: 11
Open Issues: 6
Type:project
Requires
- php: >=5.4.0
- lib-openssl: *
- react/child-process: ^0.4.1
- react/promise: ^2.4
Requires (Dev)
- php: >=7.0.0
- codeception/aspect-mock: ^2.0
- codeception/codeception: ^2.2
- codeception/specify: ^0.4.6
- mpyw/co: ^1.5
- mpyw/privator: ^2.0
- satooshi/php-coveralls: ^1.0
README
Reverse proxy for PHP built-in server which supports multiprocessing and TLS/SSL encryption.
Installing
Global install
composer global require mpyw/php-hyper-builtin-server:^3.0
If not yet, you must add ~/.composer/vendor/bin
to $PATH
.
Append the following statement to ~/.bashrc
, ~/.zshrc
or what not.
export PATH="$HOME/.composer/vendor/bin:$PATH"
Local install only for development environment
composer require --dev mpyw/php-hyper-builtin-server:^3.0
Use vendor/bin/hyper-run
as the execution path.
Usage
Quick start
hyper-run -S localhost -s localhost -t src/app/www
2 servers will start with the directory src/app/www
as the document root:
http://localhost:8000
https://localhost:44300
Servers start with first unoccupied port within range depending on a scheme.
Customize ports
hyper-run -S localhost:8080 -s localhost:4000 -t src/app/www
2 servers will start with the directory src/app/www
as the document root:
http://localhost:8080
https://localhost:4000
Command Reference
mpyw@localhost:~$ hyper-run -h Usage: hyper-run <options> Example: hyper-run -S localhost:8000 -s localhost:44300 [Required] -S "<Host>:<Port>" of an HTTP server. Multiple arguments can be accepted. -s "<Host>:<Port>" of an HTTPS server. Multiple arguments can be accepted. [Optional] -n The number of PHP built-in server clusters, from 1 to 20. Default is 10. -t Path for the document root. Default is the current directory. -r Path for the router script. Default is empty. -c Path for the PEM-encoded certificate. Default is "/Users/mpyw/.composer/vendor/mpyw/php-hyper-builtin-server/certificate.pem". Restrictions: - The option -s is only supported on PHP 5.6.0 or later. - Access logs will not be displayed on Windows. mpyw@localhost:~$
Note for Windows users
Unfortunately, cmd.exe
has no option to run via shebang #!/usr/bin/env php
, so you need to create the following batch file in the proper directory.
For Standalone PHP
@echo OFF "C:\php\php.exe" "%HOMEPATH%\.composer\vendor\mpyw\php-hyper-builtin-server\hyper-run" %*
For XAMPP
@echo OFF "C:\xampp\php\php.exe" "%HOMEPATH%\.composer\vendor\mpyw\php-hyper-builtin-server\hyper-run" %*
License
PHP Hyper Built-in Server
is open-sourced software licensed under the MIT license by @mpyw.