PHPackages                             alexpensato/laravel-api-maker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. alexpensato/laravel-api-maker

ActiveLibrary[HTTP &amp; Networking](/categories/http)

alexpensato/laravel-api-maker
=============================

Automate the generation of your REST APIs

v1.0.42(7y ago)1436MITPHPPHP ^7.1.3

Since Nov 26Pushed 7y ago3 watchersCompare

[ Source](https://github.com/alexpensato/laravel-api-maker)[ Packagist](https://packagist.org/packages/alexpensato/laravel-api-maker)[ Docs](https://github.com/alexpensato/laravel-api-maker)[ RSS](/packages/alexpensato-laravel-api-maker/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (3)Dependencies (6)Versions (4)Used By (0)

Laravel Api Maker
=================

[](#laravel-api-maker)

*Automate the generation of your REST APIs with the console generator command make:api*

Introduction
------------

[](#introduction)

This package is an extended version of the [laravel-api-generator](https://github.com/arrilot/laravel-api-generator) package. It includes a completely rewritten BaseController, now renamed to **ApiController**. This package also presents two new controller types: **ReadOnlyController**, for APIs that don't need writing capabilities; and **WebController**, for applications that need support for frontend scaffolding views.

This package relies on the **Repository Design Pattern**, which means that *Controllers* will access *Models* through a *Repository* interface, which provides better separation of concerns for data access methods and business rules. This repository implementation was inspired by [Connor Leech](https://medium.com/employbl/use-the-repository-design-pattern-in-a-laravel-application-13f0b46a3dce)'s and [Jeff Decena](https://medium.com/@jsdecena/refactor-the-simple-tdd-in-laravel-a92dd48f2cdd)'s articles.

This package also uses [Codeception/Specify](https://github.com/Codeception/Specify) and [Codeception/Verify](https://github.com/Codeception/Verify) packages to get you started with BDD-style unit testing.

This enhanced version of the **console generator** creates the following files for each Model in **one single command**:

1. ApiController extended class
2. Fractal Transformer class
3. Repository interface
4. Repository implementation class
5. Unit test file configured for BDD

It also modifies the following configuration files:

1. Adds routes to **routes/api.php**
2. Adds repository binding to **ApiServiceProvider**

This package was designed to get you started with professional REST API best practices.

Compatibility
-------------

[](#compatibility)

Laravel API MakerLaravel1.0.x5.61.1.x5.7Installation
------------

[](#installation)

*Step 1* - Run `composer require alexpensato/laravel-api-maker`

*Step 2* - Copy the `ApiServiceProvider` class to `app/Providers` folder:

`cp -R vendor/alexpensato/laravel-api-maker/templates/Providers app/Providers`

and check what you got there.

*Step 3* - Register the service providers in the `config/app.php` configuration file

```

```

*Step 4* - Laravel already provides an API routes file. To correctly configure the console generator automation process, you need to choose one of the routing templates presented in `vendor/alexpensato/laravel-api-maker/templates/routes/api.php`, and then copy it to your project's api routing file.

For instance, copy the code below to the end of your `routes/api.php` project file.

```
