PHP code example of timehunter / laravel-file-generator

1. Go to this page and download the library: Download timehunter/laravel-file-generator 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/ */

    

timehunter / laravel-file-generator example snippets

 php
'providers'=[
    ....,
    TimeHunter\LaravelFileGenerator\LaravelFileGeneratorServiceProvider::class
]
 php
'aliases'=[
     ....,
      'LaravelFileGenerator' => TimeHunter\LaravelFileGenerator\Facades\LaravelFileGenerator::class
 ]
 php


namespace App\Structure;

use TimeHunter\LaravelFileGenerator\Interfaces\InterfaceSimpleTemplateInterface;

class ExampleSimpleInterfaceTemplate implements InterfaceSimpleTemplateInterface
{

    public function getTemplateData()
    {
        return [
            'directory' => app_path() . '/Example',
            'interface_name' => 'ExampleInterface',
            'namespace' => 'App\Example',
            'functions' => [
                'public function get()',
                'public function update()'
            ],
            'annotations'=[]
        ];
    }
}
 php
 return LaravelFileGenerator::preview(new ExampleSimpleInterfaceTemplate());
 php
getTemplateData()
 php
    public function getTemplateData()
    {
        return [
            'directory' => app_path() . '/Example',
            'namespace' => 'App\Example',
            'use' => [
                'App\Http\Controllers\Controller'
            ],
            'trait_name' => 'ExampleTrait',
            'traits' => [
                'ExampleTrait'
            ],
            'annotations'=[],
            'functions' => [
                'public function get()',
                'public function update()'
            ]
        ];
    }
 php
    public function getTemplateData()
    {
        return [
            'directory' => app_path() . '/Test',
            'interface_name' => 'ExampleInterface',
            'namespace' => 'App\Example',
            'annotations'=[],
            'functions' => [
                'public function get()',
                'public function update()'
            ]
        ];
    }
 php
    public function getTemplateData()
    {
        return [
            'class_type' => 'abstract class',
            'directory' => app_path() . '/Example',
            'namespace' =>'App\Example',
            'use' => [
                'App\Http\Controllers\Controller',
            ],
            'class_name' => 'ExampleClass',
            'extends' => 'Controller',
            'implements' => ['sss', 'sss'],
            'traits' => [
                'ExampleTrait'
            ],
            'properties' => [
                'protected $repo'
            ],
            'functions' => [
                'public function get()',
                'public function update()'
            ],
            'annotations'=[]
        ];
    }