PHPackages                             bgpgroup/api-builder - 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. [API Development](/categories/api)
4. /
5. bgpgroup/api-builder

ActiveLibrary[API Development](/categories/api)

bgpgroup/api-builder
====================

Api Builder

080PHP

Since Jul 22Pushed 3y ago2 watchersCompare

[ Source](https://github.com/bgpgroup/api-builder)[ Packagist](https://packagist.org/packages/bgpgroup/api-builder)[ RSS](/packages/bgpgroup-api-builder/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

BGP API Builder
===============

[](#bgp-api-builder)

[![Latest Version on Packagist](https://camo.githubusercontent.com/604d85c77ec6d95ef0f8cb278df3bd5834d8a7899d257567f8f3f5bc8ef9258f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62677067726f75702f6170692d6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bgpgroup/api-builder)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/00f1b2365fd38bfa8b9ea9d2216c51f9002e56741a53e136b9e1f766f2447d35/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6e5769646172742f6c61726176656c2d6d6f64756c65732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/nWidart/laravel-modules)[![Scrutinizer Coverage](https://camo.githubusercontent.com/52e78f479efe5bc2827ac89f529a02cd78537180892c59da2866b50a91dc7825/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6e5769646172742f6c61726176656c2d6d6f64756c65732e7376673f6d61784167653d3836343030267374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/nWidart/laravel-modules/?branch=master)[![Quality Score](https://camo.githubusercontent.com/52be046b8acd6562334cb1dff0a8c474faa25d406ecf0520106aac54382ea2fe/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6e5769646172742f6c61726176656c2d6d6f64756c65732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/nWidart/laravel-modules)[![Total Downloads](https://camo.githubusercontent.com/682892a352e73d7f60a15e037489ac30af29234ca0f8d15d1fdc47deb067002f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62677067726f75702f6170692d6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bgpgroup/api-builder)

**API Builder** is a Laravel package for BGP system which allow to build Modules and Resources via commands.

Using this package you can build:

- Modules
- Resources
- Collections
- Requests
- DTO's
- Controllers
- Models
- Tests

You can also create it all at once using module and resource commands

Install
-------

[](#install)

To install through Composer, by run the following command:

```
composer require bgpgroup/api-builder
```

The package will automatically register a service provider and alias.

Documentation
-------------

[](#documentation)

### Modules

[](#modules)

To build a new module, by run the following command:

```
php artisan bgp:make:module Sales
```

Where *Sales* will be the module name

This command will create:

- `src/Modules/Sales/Providers/AppServiceProvider.php`
- `src/Modules/Sales/Providers/AuthServiceProvider.php`
- `src/Modules/Sales/config/sales.php`
- `src/Modules/Sales/routes/api.php`

### Collections

[](#collections)

Run the following command to build a collection:

```
php artisan bgp:make:collection Order --module=Sales
```

*Order* will be the resource name and *Sales* will be the module name

This command will create:

- `src/Modules/Sales/Collections/OrderCollection.php`

### Controllers

[](#controllers)

For controllers, run the following command:

```
php artisan bgp:make:controller Order --module=Sales
```

*Order* will be the resource name and *Sales* will be the module name

This command will create:

- `src/Modules/Sales/Controllers/OrderController.php`

### Migrations

[](#migrations)

Before run the command, you must setup the table columns

Edit `src/Modules/Sales/config/sales.php` adding 'resources' key like:

```
