PHPackages                             hub20xx/php-local-server - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [DevOps &amp; Deployment](/categories/devops)
4. /
5. hub20xx/php-local-server

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

hub20xx/php-local-server
========================

A class to manage PHP's built-in server

v1.1.5(9y ago)1221[1 PRs](https://github.com/hub20xx/php-local-server/pulls)MITPHP

Since Mar 13Pushed 8y ago1 watchersCompare

[ Source](https://github.com/hub20xx/php-local-server)[ Packagist](https://packagist.org/packages/hub20xx/php-local-server)[ RSS](/packages/hub20xx-php-local-server/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (8)Used By (0)

PHP Local Server: A class to manage PHP's built-in server
=========================================================

[](#php-local-server-a-class-to-manage-phps-built-in-server)

[![Build Status](https://camo.githubusercontent.com/6c8aa42166e413536e608542c5e15db6f042187a7264ccd57adcb5e590f78271/68747470733a2f2f7472617669732d63692e6f72672f687562323078782f7068702d6c6f63616c2d7365727665722e737667)](https://travis-ci.org/hub20xx/php-local-server)

You're on linux and you want a simple way to start and stop a local server.

Install
-------

[](#install)

Via Composer

```
$ composer require hub20xxx/php-local-server
```

Usage
-----

[](#usage)

```
require __DIR__ . '/vendor/autoload.php';

$docroot = __DIR__ . '/www';

// by default the server is running on 127.0.0.1:1111
$server = new PhpLocalServer\Server($docroot);

// you can specify the address and port
// in the constructor
$address = '127.0.0.2';
$port = '1234';
$server = new Server($docroot, $address, $port);

// or using the setters
$server = new Server($docroot);
$server->setAddress($address);
$server->setPort($port);

// setting environment variables
$server->setEnvironmentVariable('ENV', 'testing');
$server->setEnvironmentVariable('FOO', 'bar');

// starting the server
$server->start();

// using the server

// stopping the server
$server->stop();

// $server->stop() is called in the destructor in case you omit to stop the server
```

Testing
-------

[](#testing)

```
$ phpunit
```

License
-------

[](#license)

[MIT](LICENSE.md)

Credits / Thanks
----------------

[](#credits--thanks)

This package was inpired by [this blog post](http://tech.vg.no/2013/07/19/using-phps-built-in-web-server-in-your-test-suites/)

Many thanks :)

Contributing
------------

[](#contributing)

If you'd like to contribute, please use Github (issues, pull requests etc).

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

7

Last Release

3345d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4e426783ef26ab33d4bee9989fbad30ed749bea6bcdf8ef779f4ef7b894b31a4?d=identicon)[hub20xx](/maintainers/hub20xx)

---

Top Contributors

[![hub20xx](https://avatars.githubusercontent.com/u/16416438?v=4)](https://github.com/hub20xx "hub20xx (7 commits)")

---

Tags

phpdevserverclasslocallinuxBuilt-in

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hub20xx-php-local-server/health.svg)

```
[![Health](https://phpackages.com/badges/hub20xx-php-local-server/health.svg)](https://phpackages.com/packages/hub20xx-php-local-server)
```

###  Alternatives

[felixfbecker/language-server-protocol

PHP classes for the Language Server Protocol

22476.7M6](/packages/felixfbecker-language-server-protocol)[php-mcp/server

PHP SDK for building Model Context Protocol (MCP) servers - Create MCP tools, resources, and prompts

828280.5k25](/packages/php-mcp-server)[renoki-co/laravel-healthchecks

Laravel Healthchecks is a simple controller class that helps you build your own healthchecks endpoint without issues.

5654.9k](/packages/renoki-co-laravel-healthchecks)[appserver-io/webserver

Multithreaded webserver for php written in php

455.7k1](/packages/appserver-io-webserver)[natanfelles/php-server

Fine-tuning on the PHP built-in web server.

2811.9k2](/packages/natanfelles-php-server)[mmoreram/translation-server

PHP translation server

233.7k2](/packages/mmoreram-translation-server)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
