PHP code example of skagarwal / generators

1. Go to this page and download the library: Download skagarwal/generators 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/ */

    

skagarwal / generators example snippets


app/
  |
  |_Foo/
    |
    |_Foo.php // The Eloquent Model
    |
    |_Contracts/
      |
      |_FooRepository.php // black interface
    |
    |_Events/
    |
    |_Jobs/
    |
    |_Listeners/
    |
    |_Repositories/
      |
      |_EloquentFooRepository.php // impletements the FooRepository.php interface out of the box.

php artisan create:model Foo ---migration

app/
  |
  |_Foo/
    |
    |_Foo.php // The Eloquent Model
    |
    |_Contracts/
      |
      |_FooRepository.php // black interface
    |
    |_Events/
    |
    |_Policies/
    |
    |_Jobs/
    |
    |_Listeners/
    |
    |_Repositories/
      |
      |_EloquentFooRepository.php // impletements the FooRepository.php interface out of the box.

php artisan create:repository Foo

app\Foo\Contracts\FooRepository.php
app\Foo\Repositories\EloquentFooRepository.php

app\Foo\Contracts\BarRepository.php
app\Foo\Repositories\EloquentBarRepository.php

php artisan create:event UserRegistered --model=User

User\Events\UserRegistered.php

php artisan create:listener SendWelcomeEmail --event=UserRegistered --model=User

User\Listeners\SendWelcomeEmail.php

php artisan create:job RegisterUser --model=User --queued

User\Jobs\RegisterUser.php

php artisan create:policy PostPolicy --model=Post

Post\Policies\PostPolicy.php

Config/app.php

'providers' => [
  ...
  ...
  ...
  
  'SKAgarwal\Generators\GeneratorsServiceProvider',
],