oguzcandemircan / laravel-stub-generator
:description
Installs: 1 648
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 2
Forks: 2
Open Issues: 0
Requires
- illuminate/support: >=5
Requires (Dev)
- mockery/mockery: ^1.1
- orchestra/testbench: ~3.0
- phpunit/phpunit: ~7.0
- sempro/phpunit-pretty-print: ^1.0
This package is not auto-updated.
Last update: 2024-11-09 20:51:04 UTC
README
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.