1. Go to this page and download the library: Download maikwoehl/rest-recipes 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/ */
maikwoehl / rest-recipes example snippets
/**
* api.php
*
* @version 0.1
*
*/
// Index
$app->route("/recipe/", "GET", function() {
});
// Detail
$app->route("/recipe/<id>", "GET", function($id) {
});
// Modify Object
$app->route("/recipe/<id>", "PUT", function($id, $data) {
});
try {
$app->run();
} catch (RuntimeException $e) {
// Show some information that no API endpoint was called
}
/**
* api.php
*
* @version 0.1
*
*/
ticationProvider;
$security = new AuthenticationProvider(AuthenticationProvider::AUTH_HTTP_BASIC);
$app = new Router();
// Secure API route
$app->route("/secure/", "GET", function() {
$security->setHttpBasicAuthenticationCredentials("user", "password");
if (!$security->authenticate())
return false;
});
// Index
$app->route("/recipe/", "GET", function() {
});
// Detail
$app->route("/recipe/<id>", "GET", function($id) {
});
try {
$app->run();
} catch (RuntimeException $e) {
// Show some information that no API endpoint was called
}
GET api.php?q=/recipe/
GET api.php?q=/recipe/3
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.