Skip to content

Installation

Add Packages

Check the following table for Laravel version compatibility,

Laravel Versioninfyomlabs/laravel-generatorlaravelcollective/htmlinfyomlabs/adminlte-templates
9.0^5.0^6.3^5.0
8.0^3.0^6.2^3.0
7.0^2.0^6.1^3.0
6.0^1.0^6.0^3.0

Add following packages into composer.json while using it with Laravel 9.

sh
 "require": {
     "infyomlabs/laravel-generator": "^5.0",
     "infyomlabs/adminlte-templates": "^5.0"
 }

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

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

Composer Update

After adding packages, run the following command:

sh
composer update

Publish Vendor

Optionally, If you want to publish the config file and want to customize it, run the following command:

sh
php artisan vendor:publish --provider="InfyOm\Generator\InfyOmGeneratorServiceProvider"

It will publish a configuration file config/laravel_generator.php.

If you want tweak any paths or laravel settings like custom namespace, rather than regular laravel installation then you can update it here.

Check out this page and configure the generator based on your settings.

Publish Command

Publish generator stuff:

sh
php artisan infyom:publish

If you want to use localization then specify localized option,

If you have any custom locales added to lang/en/auth.php then it will be overwritten. so take a backup if need.

sh
php artisan infyom:publish --localized

By publishing API stuff, it will create following files:

sh
|- app - app directory
    |- Http - Http directory
        |- Controllers - Controllers directory
           |- AppBaseController.php - New base controller which will be used as a base class for each controller
    |- Repositories - Repositories directory
        |- BaseRepository.php - BaseRepository for all repository files
|- tests - tests directory
    |- ApiTestTrait.php - Api test trait to be used for testing
    |- Traits - directory to store created traits of models
    |- APIs - directory to store APIs tested cases
    |- Repositories - directory to store Repository tested cases

Next: If you just want to use API Generator and not Admin Panel, then you are good to go and skip next step.

But if you want to use a full Admin Panel then proceed to next step of Publish Layout Command.