Example #1
0
ini_set('display_errors', 'off');
$appEnvIncluded = @(include_once __DIR__ . "/../../clavis.php");
// Load the application configuration
$appEnvIncluded = @(include_once __DIR__ . "/../autogen/appEnv.php");
if (!$appEnvIncluded) {
    //In a non-skeleton app, we would not need to have conditional includes
    require_once __DIR__ . "/appEnv.php";
}
// In a real project include the applications secret keys
// from a location outside of the VCS controlled directories.
//require_once __DIR__."/../appKeys.php";
// Read application config params
$injectionParams = (require_once "injectionParams.php");
// Create the Tier application
$app = new TierHTTPApp($injectionParams);
$exceptionResolver = $app->getExceptionResolver();
$fn = function (ArtaxServiceBuilder\BadResponseException $badResponse) {
    echo "BadResponseException: " . $badResponse->getMessage();
    echo "Body = " . substr($badResponse->getResponse()->getBody(), 0, 200);
    var_dump($badResponse->getResponse());
};
$exceptionResolver->addExceptionHandler('ArtaxServiceBuilder\\BadResponseException', $fn);
// Make the body that is generated be shared by TierApp
$app->addExpectedProduct('Room11\\HTTP\\Body');
$app->addInitialExecutable('GithubExample\\App::initialExecutable');
// Create the routing Executable. This will create an executable that
// will generate the body of the response.
$app->addRoutingExecutable(['Tier\\Bridge\\FastRouter', 'routeRequest']);
// Add an executable to save the session the generate the appropriate headers
$app->addBeforeSendExecutable('GithubExample\\App::addSessionHeader');
// Add an executable to send the response