Lumen is a micro Framework version of Laravel. Basically its a stripped down version of Laravel that has been optimised for speed. It is appropriate for use in a range of situations where the full version of laravel is not required or where resources are at a minimum. One area where Lumen has become popular [...]
Category: Creating a REST API using Lumen
This section describes how to use the Laravel router and how to peform search queries using laravel.
Adding a CORS handler
We will be building an application that will serve up JSON responses to requests. A separate application running on a separate domain will consume those responses and make requests to the application. Having a web application that sends requests from a different domain to the webserver itself is a configuration that represents a security risk. [...]
Adding Endpoints for the Member Entity
Now that we have installed Lumen and set up middleware to handle CORs we are ready to set up our first endpoint. To do this we need a Model for the tennisclub database Member entity. Save the following code to the code \app\Models\Member.php <?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class Member extends Model { public function [...]
Dealing with the HATEOAS constraint
HATEOAS - Hypermedia As The Engine Of State requires that we add links to each Endpoint which will describe what actions can be taken on each resource at any given point in time. There are a number of different standards for this format which, at the time of writing, are competing to become the dominant [...]
Adding POST, DELETE, PUT
To complete the basic amount of functionality in line with basic CRUD functionality we need to be able to add a new member to the tennisclub, to update an existing members details and to delete members. In adding this functionality we will use the POST, PUT and DELETE verbs which are described in the HTTP [...]