Skip to content

Instantly share code, notes, and snippets.

@Potherca
Created January 16, 2014 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Potherca/8457454 to your computer and use it in GitHub Desktop.
Save Potherca/8457454 to your computer and use it in GitHub Desktop.
Simple Silex implementation to return a 418 HTTP Response. For testing purposes, obviously.
<?php
$app = new MySilexApplication();
$app->match('/api/coffee/',
function() use ($app){
$statusCode = 418;
$response = array('status' => 'ok', 'code' => $statusCode, 'message' => 'The HTCPCP Server is a teapot. The responding entity MAY be short and stout.');
return $app->json((object) $response, $statusCode);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment