1. Go to this page and download the library: Download caoym/phpboot 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/ */
caoym / phpboot example snippets
class BookController
{
public function findBooks(Request $request)
{
$name = $request->get('name');
$offset = $request->get('offset', 0);
$limit = $request->get('limit', 10);
...
return new Response(['total'=>$total, 'data'=>$books]);
}
public function createBook(Request $request)
...
}
/**
* @path /books/
*/
class Books
{
/**
* @route GET /
* @return Book[]
*/
public function findBooks($name, &$total=null, $offset=0, $limit=10)
{
$total = ...
...
return $books;
}
/**
* @route POST /
* @param Book $book {@bind request.request} bind $book with http body
* @return string id of created book
*/
public function createBook(Book $book)
{
$id = ...
return $id;
}
}