staskjs / laravel-rest by staskjs

All you need to quickly create REST controllers
4,625
1
1
Package Data
Maintainer Username: staskjs
Maintainer Contact: staskjs@mail.ru (Stas Karpov)
Package Create Date: 2017-03-20
Package Last Update: 2018-06-29
Language: PHP
License: Unknown
Last Refreshed: 2024-04-23 03:05:38
Package Statistics
Total Downloads: 4,625
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 1
Total Watchers: 1
Total Forks: 1
Total Open Issues: 0

Digitalquill Laravel REST instrumentary

Why?

Everytime projects need a REST api to work with, it finished with lots of duplicate code all over the place and what is worse, in multiple projects.

So to handle this problem, this repository was created.

For now it contains only one controller from which you can extend to get all those standard REST functions.

Controller is highly customizible by overriding some functions.

Please refer to source code to see what you can do.

Installation

composer require staskjs/laravel-rest

Then register service provider in config/app.php:

Staskjs\Rest\RestServiceProvider::class

Then just extend your controller from \Staskjs\Rest\RestController, register resource route (Route::resource) pointing to your controller and you are good to go!

Usage

You can add Form Request Validation to every request there is.

Simple override these parameters with class to use.

protected $storeRequest = ModelStoreRequest::class;

// Same with other requests, if needed

For simpler approach to validation, override rules method to return array of validation rules.