SedpMis\BaseApi

Build Status

Abstraction for api resources in Laravel. Compatible to use with Laravel 4.2 and 5.*.

Installation

Use composer to install base-api and dependencies:

composer require sedp-mis/base-api

Introduction

The purpose of this repository is to create an abstraction for common use-cases of api resources. It is a good practice to version our api so we will set our base api to api/v1. So in the following api implementations, the example resource to be used is posts.

Implementation

METHOD URL Description
GET api/v1/posts @index, List of resources
POST api/v1/posts @store, Create or store new resource
GET api/v1/posts/{id} @show, Show resource
PUT|PATCH api/v1/posts/{id} @update, Update resource
DELETE api/v1/posts/{id} @destroy, Destroy or delete resource

Notice that @<method> are the same with the controller methods in laravel.

Advance Implementation for GET methods like @index and @show.

@index and @show

@index