HTTP is one thing

Resource Oriented Application Framework

Akihito Koriyama / @koriym

APPLICATION

PROGRAMING

INTERFACE

APIs rule everything around us

  • as a hub
  • as a core value

ADD

API Driven Development

HADD

Hypermedia API Driven Development

BEAR.Sunday

A resource oriented framework

Three frameworks inside

  • DI
  • AOP
  • Hypermedia

BEAR.Resource

Hypermedia framework for object as a service

REST Constraints

  • Addressability
  • Unified Interface
  • Stateless Request
  • Connectedness

...to Object

Everything is a resource

  • MVC
  • [R]

Object as a service


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;

                        

Hypermedia
As The Engine Of Application State


$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
                    

Representation


    echo $resourceObject;

    // html / json / xml
                    

Screen

The Key of success of web

  • URI
  • Unified Interface
  • Hyper Link

Hypermedia for productivity

  • Sequence management
  • Marshaling tool
  • Decoupling components

"HTTP is one thing"

Why should we separate the API and HTML ?

The API is core,
REST is central.

bearsunday.github.io