PHP code example of munza / scaffolder

1. Go to this page and download the library: Download munza/scaffolder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

munza / scaffolder example snippets


// config/app.php
[
    'providers' => [
        Munza\Scaffolder\ScaffolderServiceProvider::class,
    ]
]

    // bootstrap/app.php
    $app->configure('scaffolder');
    

// app/Console/Generators/NewGenerator.php

class NewGenerator extends Command
{
    protected $signature = 'make:new {name}';

    protected $description = 'Command description';

    public function create()
    {
        return $this->createFileFromStub(
            base_path("/app/NewFolder/{$this->argument('name')}.php"),
            'scaffolder::new',
            [
                'class' => $this->argument('name'),
            ]
        );
    }
}

// app/Console/Kernel.php

class Kernel extends ConsoleKernel
{
    protected $commands = [
        Generators\NewGenerator::class,
    ];
}
bash
    $ php artisan vendor:publish --provider="Munza\Scaffolder\ScaffolderServiceProvider"
    
bash
    $ php artisan vendor:publish
    
bash
    $ cp vendor/munza/scaffolder/resources/config/scaffolder.php config/scaffolder.php
    
bash
$ php artisan make:generator NewGenerator
bash
$ php artisan make:stub new
bash
$ php artisan make:new NewFile