Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skyronic/laravel-file-generator
A Laravel package which helps you automate creation of files.
https://github.com/skyronic/laravel-file-generator
boilerplate generator laravel
Last synced: about 4 hours ago
JSON representation
A Laravel package which helps you automate creation of files.
- Host: GitHub
- URL: https://github.com/skyronic/laravel-file-generator
- Owner: skyronic
- License: mit
- Created: 2017-04-05T13:38:15.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-04-24T03:58:36.000Z (7 months ago)
- Last Synced: 2024-04-24T07:12:21.978Z (7 months ago)
- Topics: boilerplate, generator, laravel
- Language: PHP
- Homepage:
- Size: 54.7 KB
- Stars: 65
- Watchers: 4
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Laravel file generator
This is a Laravel package which helps you automate creation of files.
### Benefits
* If you create a type of file frequently, you can automate it and improve productivity.
* Prevent "context switching" where you lose focus for 30 seconds while you create new files, directories and populate it with boilerplate.
* Comes with several built-in boilerplates. Easy to share your own as github gists.
* All boilerplates and generators are part of your repository, letting you share standard templates with your team.
* Find things like `artisan make:model` and `artisan make:controller` useful? You can make your own.
* All boilerplates can be written as blade templates.## Quick Start
**Step 1**: Install the package
```bash
$ composer require skyronic/laravel-file-generator
```**Step 2**: Publish the "boilerplates" - an included set of useful boilerplates like PHP Classes.
```bash
$ php artisan vendor:publish --tag='boilerplates'
```**Step 3**: You can list all the installed boilerplates
```bash
$ php artisan generate:list+---------------+------------------------------+
| Type | Name |
+---------------+------------------------------+
| css | CSS File |
| js | JavaScript File |
| php:class | PHP Class in 'app' Directory |
| php:trait | PHP Trait in 'app' Directory |
| view | Blade Template |
+---------------+------------------------------+Use `artisan generate ` to create a new file!
```**Step 5**: You can create a php class now:
```bash
$ php artisan generate php:class "Support/Helpers/AwesomeHelper" --extends "BaseHelper" --constructorCreated file [ app/Support/Helpers/AwesomeHelper.php ]
```The generator `php:class` creates one by default in. You can now open app/Support/Helpers/AwesomeHelper.php
```php
"App\Support\Helpers"// For non `app` directories, you need to manually specify namespace routes
// $path = "tests/Unit/HelperTests/AwesomeHelperTest.php"
Format::getNamespace ($path, 'tests', "Tests")
// -> "Tests\Unit\HelperTests"
```## Example: PHP Class generator
First, be sure that you've run `php artisan vendor:publish --tag='boilerplates'` and check `app/resources/boilerplates/php__class.boilerplate.txt`
```
{
"name": "PHP Class in 'app' Directory",
"out": "app/{{ $name }}.php",
"params": {
"extends": "optional",
"constructor": "flag"
}
}
---