PHP Mock HTTP Server: Test HTTP requests with configurable responses

Recommend this page to a friend!
  Info   Example   View files (15)   Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 65 All time: 9,704 This week: 362
Version License PHP version Categories
http_request_mock_se 1.0GNU Lesser Genera...5HTTP, PHP 5, Testing
Description Author

This package can test HTTP requests with configurable responses.

There is a factory class that can handle HTTP requests from a real HTTP server that executes a PHP script that class.

The factory class creates the actual mock object that will process the HTTP request and generates the HTTP response.

Separate classes define the strategy to handle the requests generating responses in XML, JSON or some other raw format based on parameters taken from the request URI.

Picture of nvb
  Performance   Level  
Name: nvb <contact>
Classes: 10 packages by
Country: Germany Germany
Age: ???
All time rank: 1809112 in Germany Germany
Week rank: 762 36 in Germany Germany
Innovation award
Innovation award
Nominee: 6x


Http Test Request Server

This component should easy up your testing. It can also be used as a mocked endpoint.

The current change log can be found here. The latest stable release is Latest stable


Supported GET parameters


Url encoded string.


One of the following three:

  • json
  • raw
  • xml


Any number is working.


Returning JSON

Url with all available and supported get parameters


will return


Returning RAW

Url with all available and supported get parameters


will return

There is no foo without a bar

Returning XML

Url with all available and supported get parameters


will return

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

Mature Projects

This project has a small number of source lines of code (less than 127 lines of code without the syntactic sugar). It is just a small thing you can use. There are a lot of mature projects out there like http-server-mock to name just one.

Final Words

Star it if you like it :-). Add issues if you need it. Pull patches if you enjoy it. Write a blog entry if you use it. Donate something if you love it :-].

File Role Description
public (1 file)
source (2 files, 2 directories) Data Auxiliary data
composer.json Data Auxiliary data
LICENSE Lic. License text Doc. Documentation

  Files  /  public  
File Role Description
   index.php Example Example script

  Files  /  source  
File Role Description
Content (4 files)
Output (4 files)
   HttpRequestMockServer.php Class Class source
   HttpRequestMockServerFactory.php Class Class source

  Files  /  source  /  Content  
File Role Description
   DefaultContentBuilder.php Class Class source
   DefaultProvidedCon...HandlerStrategy.php Class Class source
   ProvidedContentHan...rategyInterface.php Class Class source
   RawProvidedContentHandlerStrategy.php Class Class source

  Files  /  source  /  Output  
File Role Description
   JsonOutputStrategy.php Class Class source
   OutputStrategyInterface.php Class Class source
   RawOutputStrategy.php Class Class source
   XmlOutputStrategy.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,704
This week:362

For more information send a message to info at phpclasses dot org.