Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (23 sloc) 0.786 kb
namespace PHPMachine;
require dirname(__FILE__).'/src/Loader.php';
function http_request($dispatchPath) {
$request = new \PHPMachine\Request();
$response = new \PHPMachine\Response();
$response = execute_request($request, $response, $dispatchPath);
function execute_request(Request $request, Response $response, $dispatchPath) {
$dispatchList = require $dispatchPath;
$result = Dispatcher::dispatch($dispatchList, $request);
if ($result[0]===false) {
$body = ErrorHandler::handleError(404, $request, 'Resource was not found');
return $response;
else {
return \PHPMachine\DecisionCore::handleRequest($result[0], $request, $response);
Jump to Line
Something went wrong with that request. Please try again.