As the complexity of API’s increase, improving the ways we create them becomes a necessity.
Let’s take a journey exploring an efficient way of building well-tested API’s that are easy to develop and maintain by wiring up several different open-source packages.
In this tutorial, we will build a very simple API for fruits that lists all the fruits, shows one fruit, creates a fruit, and finally deletes a fruit.
The API will allow anyone to list and show fruits but we will use JWT Authentication to protect creating and deleting operations so only the registered users can use them.
Before we start, let’s look at everything we will cover:
- Landmark 1 : Prepare our TDD environment and creating our first test.
- Landmark 2: Installing and configuring Dingo API package.
- Landmark 3: What are Transformers, why the need for them and how to use thephpleague / fractal as our transformation layer.
- Landmark 4: Introduction about JWT and how to use tymondesigns / jwt-auth for our token based authentication.
- Landmark 5: How to use laravel-apidoc-generator to generate nice documentation for our API.
So, pack your bags and let’s dive into our journey!