On Github koriym / http-is-one-thing
API Driven Development
So this means the API service is also core when programming.Hypermedia API Driven Development
API's are great but in order to gain a richer service environment then going the next step of introducing hypermedia into our API's is important. We could call this HADD.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 ?
HTTP is a single entity.