Fast and simple implementation of a REST API based on the Laravel Framework, Repository Pattern, Eloquent Resources, Translatability, and Swagger.

Overview

Laravel Headless

What about?

This allows a fast and simple implementation of a REST API based on the Laravel Framework, Repository Pattern, Eloquent Resources, Translatability, and Swagger for the documentation.

The objective is to have the least code to write for adding new kind of content: the most important process is carried out in the Abstract files.

In a development environment, the display of the Debugbar (barryvdh/laravel-debugbar) has been modified in a Middleware to integrate with the json return.

Cache

Several levels of caches are used to optimize the display: a first one with the bundle genealabs/laravel-model-caching for Objects, a second one in the process of the Resources display, and a third one with a configurable Cache-Control in Header.

By default, GET routes are behind cache. To remove that, you have to add the following GET parameter: removeCache=true

Requirements

Here are the requirements for the project:

Procedures

To install the project:

  • Create one vhost with documentRoot positionned on "website/public"
  • Duplicate website/.env.example to website/.env
  • Modify website/.env with expected data (mainly DB parameters)
  • Run the script:
sh scripts/install.sh

If for some reasons your project stop working, do the following:

cd website
composer install
php artisan migrate

Commands

  • To refresh cache, do the following:
cd website
sh scripts/refresh_cache.sh
  • To reset database:
cd website
sh scripts/reset_database.sh
  • To reset database with default user:
cd website
sh scripts/generate_data.sh
  • To update existing database:
cd website
php artisan migrate
  • To launch all API Commands with configured schedule, add in crontab the following:
* * * * * cd /path-to-your-project && php artisan schedule:run

Swagger

  • You can access to the Swagger interface from url : {APP_URL}/api. {APP_URL} is setted in your .env file
  • To regenerate the documentation, you can run the following command:
cd website
php artisan l5-swagger:generate
  • Alternatively, you can set L5_SWAGGER_GENERATE_ALWAYS to true in your .env file. It will allow your documentation to be automatically generated.

You can retrieve an User Token from the route /users/auth/login in Authentication Tag on Swagger interface.
Copy this token and past it in "Authorize" button (see above right of the Swagger interface) to activate the JWT mode

You might also like...
A simple Content Moderation System for Laravel 5.* that allows you to Approve or Reject resources like posts, comments, users, etc.

Laravel Moderation A simple Moderation System for Laravel 5.* that allows you to Approve or Reject resources like posts, comments, users, etc. Keep yo

Twig-based PatternEngine for Pattern Lab.

Twig PatternEngine for Pattern Lab The Twig PatternEngine allows you to use Twig as the template language for Pattern Lab PHP. Once the PatternEngine

Laravel Design Pattern Generator (api generator)
Laravel Design Pattern Generator (api generator)

Laravel Design Pattern Generator (api generator) you can create your restful api easily by using this library and you can filter, sort and include elo

Composer repository implementation for ZIPs.

Release Belt — Composer repo for ZIPs Release Belt is a Composer repository, which serves to quickly integrate third–party non–Composer releases into

Use Laravel's built-in ORM classes to query cloud resources with Steampipe.
Use Laravel's built-in ORM classes to query cloud resources with Steampipe.

Laravel Steampipe Use Laravel's built-in ORM classes to query cloud resources with Steampipe, an open source CLI to instantly query cloud APIs using S

The fastest way to make a powerful JSON:API compatible Rest API with Laravel.
The fastest way to make a powerful JSON:API compatible Rest API with Laravel.

The first fully customizable Laravel JSON:API builder. "CRUD" and protect your resources with 0 (zero) extra line of code. Installation You can instal

Filter resources with request parameters

FilterWhere Filter resources with request parameters Author: Thomas Jakobi [email protected] License: GNU GPLv2 Features With this MODX Revolu

Lumen rest api demo with Dingo/Api, JWT, CORS, PHPUNIT

lumen-api-demo 这是一个比较完整用 lumen 5.7 写的的 REST API 例子。使用了 dingo/api ,jwt 实现登录,功能上很简单,登录,注册,发帖,评论,单元测试(正在补充)。 lumen5.x 请看对应的分支 有需要随时联系我 lumen/laravel/rest

Laravel specification pattern

Laravel specification pattern Filter an Illuminate collection with specifications. Installation You can install the package via composer: composer req

Owner
Julien SCHMITT
Backend Developer. PHP (Symfony / Laravel) | Node.js
Julien SCHMITT
Repository Pattern implementation for Laravel

This is a Simple Repository Pattern implementation for Laravel Projects and an easily way to build Eloquent queries from API requests.

Ephraïm SEDDOR 1 Nov 22, 2021
Need some filters? This package is based on the Repository Design Pattern to let you create specific queries easily.

DevMakerLab/Laravel-Filters Need some filters? This package is based on the Repository Design Pattern to let you create specific queries easily. Insta

DevMakerLab 19 Feb 20, 2022
Database Repository / PHP Repository / Laravel Repository

Database Repository / PHP Repository / Laravel Repository Installation Use following command to add this package to composer development requirement.

Bakery 6 Dec 21, 2022
A filesystem-like repository for storing arbitrary resources.

The Puli Repository Component Latest release: 1.0.0-beta10 PHP >= 5.3.9 The Puli Repository Component provides an API for storing arbitrary resources

Puli 435 Nov 20, 2022
🖖Repository Pattern in Laravel. The package allows to filter by request out-of-the-box, as well as to integrate customized criteria and any kind of filters.

Repository Repository Pattern in Laravel. The package allows to filter by request out-of-the-box, as well as to integrate customized criteria and any

Awes.io 160 Dec 26, 2022
A package to implement repository pattern for laravel models

Laravel Model UUID A simple package to use Repository Pattern approach for laravel models . Repository pattern Repositories are classes or components

null 26 Dec 21, 2022
A straightforward implementation of the Circuit Breaker pattern for Laravel 9

Laravel Circuit Breaker A straightforward implementation of the Circuit Breaker pattern for Laravel Framework 9 (using Memcached). Installation You ca

Leonardo Vieira 2 Mar 22, 2022
A lightweight domain event pattern implementation for Doctrine2.

Knp Rad Domain Event A lightweight domain event pattern implementation for Doctrine2. Official maintainers: @Einenlum Installation With composer : $ c

KNP Labs 5 Sep 23, 2022
This Laravel Nova settings tool based on env, using nativ nova fields and resources

Nova Settings Description This Laravel Nova settings tool based on env, using nativ nova fields and resources Features Using native Nova resources Ful

Artem Stepanenko 21 Dec 28, 2022
A base API controller for Laravel that gives sorting, filtering, eager loading and pagination for your resources

Bruno Introduction A Laravel base controller class and a trait that will enable to add filtering, sorting, eager loading and pagination to your resour

Esben Petersen 165 Sep 16, 2022