• Reading time ~ 1 min
  • 10.08.2022

Statix Server is an object-oriented wrapper around PHP's built-in server. Once you install the composer package, getting started is as minimal as the following:

use Statix\Server\Server;
 
require_once './vendor/autoload.php';
 
Server::new()->start();
 
// or
(new Server)->start();

The server class has an array-based configuration of options, or you can use the class' fluent API:

Server::new()
    ->usePHP('path')
    ->onHost('localhost')
    ->onPort('8080')
    ->root('./content')
    ->useRouter('./router.php')
    ->withEnvVars([
        'APP_DYNAMIC_ENV' => 'server'
    ])->withoutEnvVars([
        'APP_KEY',
    ]);

It also supports use-cases like capturing server output, running in the background and programmatically stopping the server.

You can learn about this package, get full installation instructions, and view the source code on GitHub. This package uses PestPHP if you want to see an example in the wild of using Pest for testing!

Comments

No comments yet
Yurij Finiv

Yurij Finiv

Full stack

ABOUT

Professional Fullstack Developer with extensive experience in website and desktop application development. Proficient in a wide range of tools and technologies, including Bootstrap, Tailwind, HTML5, CSS3, PUG, JavaScript, Alpine.js, jQuery, PHP, MODX, and Node.js. Skilled in website development using Symfony, MODX, and Laravel. Experience: Contributed to the development and translation of MODX3 i...

About author CrazyBoy49z
WORK EXPERIENCE
Contact
Ukraine, Lutsk
+380979856297