2017 © Pedro Peláez
 

library shamserver

Build mini web servers in PHP for testing

image

pjdietz/shamserver

Build mini web servers in PHP for testing

  • Tuesday, February 10, 2015
  • by pjdietz
  • Repository
  • 1 Watchers
  • 0 Stars
  • 205 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

ShamServer

Build Status, (*1)

ShamServer allows you to build mini web servers for testing., (*2)

It uses PHP's built in web server feature to spawn a separate process that listens for incoming requests and responds to them using the router script you provide., (*3)

use pjdietz\ShamServer\ShamServer;

$host = "localhost";
$port = 8080;
$router = "/path/to/my/router.php";

// Start up a testing web server.
$server = new ShamServer($host, $port, $router);

// A server is now listening at http://localhost:8080

// Shut down the web server.
$server->stop();

StringShamServer

You can also use StringShamServer to create the router file for you. When you instantiate, pass a string containing the entirety of a PHP router script. The instance will write this to a temporary file, use it for the server, and them remove it., (*4)

// Create a server that always responds with a 401 status code.
$host = "localhost";
$port = 8080;
$router = "<?php http_response_code(401);";
$server = new StringShamServer($host, $port, $router);

Routers

For more information on how to write router scripts, see the PHP Manual., (*5)

Install

Add an entry for "pjdietz/shamserver" to your composer.json file's require or require-dev section., (*6)

Copyright © 2014 by PJ Dietz Licensed under the MIT license, (*7)

The Versions

10/02 2015

dev-master

9999999-dev https://github.com/pjdietz/ShamServer

Build mini web servers in PHP for testing

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • lib-curl *

 

The Development Requires

by PJ Dietz

curl http webserver

10/02 2015

v1.0.1

1.0.1.0 https://github.com/pjdietz/ShamServer

Build mini web servers in PHP for testing

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • lib-curl *

 

The Development Requires

by PJ Dietz

curl http webserver

26/07 2014

v1.0.0

1.0.0.0 https://github.com/pjdietz/ShamServer

Build mini web servers in PHP for testing

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • lib-curl *

 

The Development Requires

by PJ Dietz

curl http webserver