RESTful

Web Service

 

Why REST?

Representational State Transfer

is guidelines and best practices

for creating

scalable web services.

RESTful systems communicate over the Hypertext Transfer Protocol with the same HTTP verbs (GET, POST, PUT, DELETE, etc.) used by web browsers to retrieve and send data.

REST is

Client–server

Stateless

Cacheable

Layered system

Separation of clients from servers.

Clients are not concerned with data storage.

Servers are not concerned with the user state

So that servers can be simpler and more scalable.

Each request from client contains all the information necessary to service the request

Session state is held in the client

Clients can cache responses

 

A client cannot tell whether it is connected directly to the end server

Intermediary servers may improve system scalability, security by enabling load balancing

Uniform interface

The uniform interface simplifies and decouples the architecture, which enables each part to evolve independently

RESTful API HTTP methods

Verbs and Actions

PHP RESTful Frameworks

Micro

CodeIgniter

Lavarel

Symfony

Zend Framework

Full

<?php
$app = new \Slim\Slim();
$app->get('/hello/:name', function ($name) {
    echo "Hello, $name";
});
$app->run();