All Projects → natanfelles → php-server

natanfelles / php-server

Licence: MIT license
Fine tuning on the PHP Built-in web server

Programming Languages

PHP
23972 projects - #3 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to php-server

reactive-slim
A bridge to use SlimPHP within ReactPHP
Stars: ✭ 25 (+8.7%)
Mutual labels:  php-server, php-webserver
RTFMbot
Discord bot for programming, runs code (600+ langs), queries/show docs and references
Stars: ✭ 184 (+700%)
Mutual labels:  rewrite
media manager autorewrite
Generiert schöne, SEO-freundliche URLs für Medien
Stars: ✭ 30 (+30.43%)
Mutual labels:  rewrite
docker-php
Docker for PHP development
Stars: ✭ 18 (-21.74%)
Mutual labels:  php-development
soar
SQL Optimizer And Rewriter
Stars: ✭ 7,786 (+33752.17%)
Mutual labels:  rewrite
RulesBot
A bot for creating rules and give members a role when they accept the rules
Stars: ✭ 13 (-43.48%)
Mutual labels:  rewrite
seourls
phpBB Extension: URL rewriting for phpBB forums
Stars: ✭ 44 (+91.3%)
Mutual labels:  rewrite
redaxo url
REDAXO 5 AddOn zur URL-Generierung für eigene AddOns (ehemals Url Control, ehemals Frau Schultze)
Stars: ✭ 43 (+86.96%)
Mutual labels:  rewrite
Spectrum
A Discord bot with tons of features, written in Python, made for fun.
Stars: ✭ 27 (+17.39%)
Mutual labels:  rewrite
vscode-phpserver
Visual Studio Code extension to quickly serve your PHP projects :)
Stars: ✭ 62 (+169.57%)
Mutual labels:  php-server
php-server-manager
Manage PHP built-in server in node
Stars: ✭ 23 (+0%)
Mutual labels:  php-server
mixerapi
A CakePHP Plugin for RESTful API Development [READ-ONLY]
Stars: ✭ 26 (+13.04%)
Mutual labels:  php-server
rawphp
A powerful, robust and API-first, PHP framework that helps people from different PHP backgrounds work on the same project seamlessly. You can write Laravel, CakePHP, Slim, Symphone and Procedural PHP code inside it and it all works perfectly. Its the PHP Framework for everyone.
Stars: ✭ 31 (+34.78%)
Mutual labels:  php-server
http-server-static-content
Static content / file serving for Amp's HTTP server.
Stars: ✭ 19 (-17.39%)
Mutual labels:  document-root

PHP Server

Latest release PHP version Packagist downloads

Fine tuning on the PHP Built-in web server

PHP Built-in web server autoindex

See release notes at: https://github.com/natanfelles/php-server/releases

Installation

Composer

Open your terminal and run:

composer global require natanfelles/php-server

Add the composer bin path to your .bashrc:

echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc

Manual

Download and extract the php-server project folder.

Add the php-server alias to your .bashrc:

echo 'alias php-server="~/php-server/bin/php-server"' >> ~/.bashrc

Config

You can run the php-server in any folder of your operating system.

Each time you run the php-server command, it will look up if there is a file named php-server.ini in the current directory. If found, your settings will override the default settings.

A quick example file content is:

php = PHP_BINARY
host = localhost
port = 8080
root = ./public
autoindex = true
index = index.php
error_reporting = E_ALL

[ini]
display_errors = 1
display_startup_errors = 1
max_execution_time = 360
post_max_size = 200M
upload_max_filesize = 200M
; Array of runtime extensions:
extension[] = mysqli
extension[] = zip

[server]
ENVIRONMENT = development

You can use the command php-server new to create a new configuration file in the current directory.

Explanation

General Vars

Key Default Value Description
php PHP_BINARY PHP binary path or command
host localhost Server host
port 8080 Server host port
root getcwd() Document root. The location that will be the public root of your website.
autoindex true Determines if the server will list directory contents if it does not find an index file.
index index.html index.php The names of the index files separated by spaces.
error_reporting E_ALL Sets the level of errors that will be reported.

Sections

Section Description
ini Used to set custom php.ini directives.
server Used to set custom Server and execution environment information.

Knowing this, just create (if necessary) a php-server.ini file, run the server and you're done.

Run

As you can see in the config. You can create a php-server.ini file to leave the settings of each project already pre-established.

But, you can also simply run php-server and the server will already be available at http://localhost:8080.

The php-server command can receive some parameters and they are:

Parameter Description
--php PHP binary path or command
--host Server host
--port Server host port
--root Document root

For example, to run the server on a different port:

php-server --port 8081

Or, also with a different version of PHP than the default:

php-server --php php7.4 --port 8081

Right. You get the idea. If you want to run on a different host you can add the host to the hosts file of your operating system.

Contribute

Hello, how nice that you are reading this.

If you have any idea to improve this project or something is not working as it should, do not hesitate to open an issue and if you have solved the problem feel free to open a Pull Request.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].