oguzcandemircan/laravel-stub-generator

:description
9,998 7
Install
composer require oguzcandemircan/laravel-stub-generator
Latest Version:v0.1.1
License:MIT
Last Updated:Jul 10, 2021
Links: GitHub  ·  Packagist
Maintainer: oguzcan

Laravel Stub Generator

Latest Version on Packagist Total Downloads

This is where your description should go. Take a look at contributing.md to see a to do list.

Installation

Via Composer

$ composer require oguzcandemircan/laravel-stub-generator

Config

return [
    'source_path' => storage_path('stubs/source'), // stubs source path
    'target_path' => storage_path('stubs/target'), // stubs target path
];

Usage

Stub file:

//storage/stubs/source/model.stub

namespace {{namespace}};

use Illuminate\Database\Eloquent\Model;

class {{modelName}} extends Model
{
    protected $fillable = [{{fillable}}];
}

Generate:


LaravelStubGenerator::source('model')->params([
  '{{modelName}}' => 'UserModel',
  '{{namespace}}' => 'App\Models',
  '{{fillable}}' => "'name', 'email', 'age'",
])->generate();

Save:


LaravelStubGenerator::source('model')->params([
  '{{modelName}}' => 'UserModel',
  '{{namespace}}' => 'App\Models',
  '{{fillable}}' => "'name', 'email', 'age'",
])->save('UserModel.php');

// force save
->save('UserModel.php', true);

Output:

//storage/stubs/target/UserModel.php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class UserModel extends Model
{
    protected $fillable = ['name', 'email', 'age'];
}

Download:


LaravelStubGenerator::source('model')->params([
  '{{modelName}}' => 'UserModel',
  '{{namespace}}' => 'App\Models',
  '{{fillable}}' => "'name', 'email', 'age'",
])->download('UserModel.php');

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits

License

license. Please see the license file for more information.

Related Packages

akamuraasai/crudgen

CRUD Generator for Laravel 5.x with GUI interface.

444 1
arcanedev/markup

PHP HTML Markup generator

444 5
ultrono/laravel-sitemap

Sitemap generator for Laravel 11, 12 and 13

504,448 36

Version History

Version Released Laravel License
v0.1.1 >=5 MIT
v0.1.0 ~5 MIT