PHP code example of kartenmacherei / rest-framework
1. Go to this page and download the library: Download kartenmacherei/rest-framework library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kartenmacherei / rest-framework example snippets
// create a request
$request = Request::fromSuperGlobals();
// create config object
// 'app-name' will be used as newrelic appname, if monitoring was enabled
// bool $enableMonitoring if true, framework will set newrelic transaction name based on mapping
// array $transactionMapping, class name to transaction name mapping array for each action. If action was not set, fallback is transaction_name_was_not_set
$config = new Config('app-name', $enableMonitoring, $transactionNamesMapping);
// create a new instance of the framework
$framework = Framework::createInstance($config);
// register a RestResource Router
$framework->registerResourceRouter(new BasketResourceRouter());
// let the framework process the request
$response = $framework->run($request);
// send the response to the client
$response->flush();