1. Go to this page and download the library: Download tagged/rest 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/ */
tagged / rest example snippets
$routes => array(
"/login" => "login",
"/health" => "health",
# the scope operator allows for setting a specific method
"/health/echo" => "health::showParams",
# a namespace URL. Children of this are appended.
"/users/[i:userid]" => array(
"/loginhistory" => "loginhistory",
"/messages" => "messages",
"/photos" => "photos",
"/photos/[i:photoid]" => "photos"
)
)
class api_v2_photos extends \Tagged\Rest\Api\Base {
public function __construct() {
$this->_registerInputSchema( "find", array(
"title" => "Query for user's uploaded photos by date, paginated",
"type" => "object",
"properties" => array(
"dateRange" => \Tagged\Rest\Schema::DateRange(),
"pagination" => \Tagged\Rest\Schema::Pagination(array(
"defaultPage"=>1,
"defaultSize"=>2,
)),
),
"tion find($request) {
$dao = new tag_dao_photo();
list($start,$end) = \Kleinbottle\Schema\DateRange::getDates($request->dateRange);
$photoset = $dao->getPhotosByDate(
$start,
$end,
$request->pageNumber,
$request->pageSize
);
return array(
"size" => count($photoset),
"photos" => $photoset,
)
}
public function fetch($request) {
$uid = $request->userid;
$pid = $request->photoid;
$dao = new tag_dao_photo();
return $dao->getPhoto(
$uid,
$pid
);
}
}