API Driven Development
Hypermedia API Driven Development
A resource oriented framework
Hypermedia framework for object as a service
...to Object
class Order
{
/**
* @Link(rel="payment", href="app://self/payment{?order_id, card_number}", method="put")
*/
public function onPost($drink)
{
// component layer (business logic)
...
$this->code = 201;
return $this;
$order = $resource
->post
->uri('app://self/order')
->withQuery(['drink' => 'latte'])
->eager
->request();
$payment = [
'credit_card_number' => '123456789'
];
$response = $resource->href('pay', $payment);
echo $response->code; // 201 Created
echo $resourceObject;
// html / json / xml
Why should we separate the API and HTML ?