1. Installing via Boilerplates (Fresh Laravel Projects)
  2. Installing into existing Laravel Projects
    1. Add Packages
    2. Composer Update
    3. Add Service Providers
    4. Add Aliases
    5. Publish Vendor
    6. Update API Routes
    7. Customize Configuration
    8. Publish

Installing via Boilerplate (Fresh Laravel Projects)

If you are starting a fresh new project with laravel then it can be the best option for you. You can skip all these steps and directly clone available boilerplate with all packages installed.

You can find boilerplate here: AdminLTE Templates

You can find complete steps here.

Installing into existing Laravel Projects

If you have any existing project then you can continue with following steps.

Add Packages

Add following packages into your composer.json.

"require": {
    "infyomlabs/laravel-generator": "5.5.x-dev",
    "laravelcollective/html": "^5.5.0",
    "infyomlabs/adminlte-templates": "5.5.x-dev"

If you want to use CoreUI then install coreui-templates instead of adminlte-templates.

If you want to generate a swagger annotations for your api documentation, you need to install following packages with it,

"require": {
    "infyomlabs/swagger-generator": "dev-master",
    "appointer/swaggervel": "dev-master"

Check the full installation process of that here.

If you want to use Generate from Table option, you need to install,

"require": {
    "doctrine/dbal": "~2.3"

Composer Update

After adding packages, run the following command:

composer update

Add Service Providers

Add following service providers into your providers array in config/app.php


Add Aliases

Add following alias to aliases array in config/app.php

'Form'      => Collective\Html\FormFacade::class,
'Html'      => Collective\Html\HtmlFacade::class,
'Flash'     => Laracasts\Flash\Flash::class,

Publish Vendor

Run the following command:

php artisan vendor:publish

Update API Routes

Open app\Providers\RouteServiceProvider.php and update mapApiRoutes method as following:


We have added as prefix to separate out named routes of api and web. Also its a better way to store api controllers in separate directory with separate namespace. so we have added "\\API" suffix in namespace.

Customize Configuration (optional)

If you have tweaked any paths or laravel settings like custom namespace, rather than regular laravel installation, check out this page and configure the generator based on your settings


Publish generator stuff:

php artisan infyom:publish

By publishing api stuff, it will create following files:

  • appapp directory
    • HttpHttp directory
      • ControllersControllers directory
        • AppBaseController.phpNew base controller which will be used as a base class for each controller
  • teststests directory
    • ApiTestTrait.phpApi test trait to be used for testing
    • Traitsdirectory to store created traits of models
    • APIsdirectory to store APIs tested cases
    • Repositoriesdirectory to store Repository tested cases

Recommended: If you have a fresh new laravel application and want a basic admin panel layout with adminlte admin panel, then you can use Publish Layout Command.

Now we are all set to get started with the generator.