Download the PHP package thenlabs/http-server without Composer
On this page you can find all versions of the php package thenlabs/http-server. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package http-server
HttpServer
A HTTP server written in PHP with help of the Symfony Components.
If you like this project gift us a ⭐.
Installation.
$ composer require thenlabs/http-server
Usage.
Create a file with the next example content:
You should change the content according to your needs.
This file should be executed like that:
$ php run-server.php
Once does it, we can navigate to the URL and we will see the respectively page.
In our example, we are serving the
index.html
file which is stored within thetests/document_root
directory.
Creating custom routes.
The HttpServer use the Symfony Routing Component for handle the routing, therefore, you can use all the his possibilities.
The next example shown the way to creating a custom route which only can be access by a GET request.
Using the logs.
Like you can will verify, by default are will shows in the console the result of all server requests.
The logs are created with help of the popular Monolog library.
The next example showns a way to put the logs in a file.
Development.
Running the tests.
Start the selenium server.
$ java -jar path/to/selenium-server-standalone-x.y.z.jar
Run PHPUnit.
$ ./vendor/bin/pyramidal
All versions of http-server with dependencies
symfony/event-dispatcher Version >=4.4
symfony/mime Version >=4.4
symfony/routing Version >=4.4
monolog/monolog Version ^2.1
thenlabs/socket-server Version ^1.1.4