Skip to content

mrickyansyah/laravel-command-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Laravel Command Generator

To make it easier to make commands in laravel and can already be used with .stub files.

Laravel artisan documentation

How to use

  1. Paste file CommandGenerator.php to App\Console\Commands.
  2. Replace CommandGenerator class to YourClass.
  3. Rename the file accordingly.
  4. if your command interact with file .stub create file stub in App\Console\stubs.
  5. Edit property in file CommandGenerator.php.

Example code

/**
 * The name and signature of the console command.
 *
 * @var string
 */
protected $signature = 'make:enum {name}'; // {name} don't change it
/**
 * The console command description.
 *
 * @var string
 */
protected $description = 'Create spatie enum';

app/Console/stubs/create-enum.stub

/**
 * the stub file path
 * 
 * @var string
 */
protected $stubFile = 'create-enum';

app/Console/stubs/create-enum.stub

/**
 * the stub file path
 * 
 * @var string
 */
protected $stubFile = 'create-enum';
/**
 * the class namespace
 * 
 * @var string
 */
protected $namespace = 'App\\Enums';
/**
 * the path of generate file
 * 
 * @var string
 */
protected $pathGenerateFile = 'app/Enums';

About

simplify to use laravel command with .stub file

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages