Download the PHP package on3n3o/generators without Composer
On this page you can find all versions of the php package on3n3o/generators. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download on3n3o/generators
More information about on3n3o/generators
Files in on3n3o/generators
Package generators
Short Description Custom Laravel File Generators with config and publishable stubs.
License MIT
Informations about the package generators
Laravel File Generators
Custom Laravel File Generators with a config file and publishable stubs. You can publish the stubs. You can add your own stubs to generate.
This package is being used in the Admin Starter Project that focusses on test driven development and has the foundation ready for you.
Commands
Option for all the commands
--force
This will override the existing file, if it exists.
Option for all the commands, except views
and migration:pivot
--plain
This will use the .plain stub of the command (generate an empty controller)
Customization
This is for all except the migration
and migration:pivot
commands
You can specify a custom name of the file to be generated. You can add the --plain or --force options. You can override the default stub to be used. You can create your own stubs with the available placeholders. You can create new settings' types, for example:
- 'exception' => ['namespace' => '\Exceptions', 'path' => './app/Exceptions/', 'postfix' => 'Exception'],
Views Custom Stubs
Installation
Update your project's composer.json
file.
Add the Service Provider (Laravel 5.5+ has automatic discovery of packages)
You'll only want to use these generators for local development, add the provider in app/Providers/AppServiceProvider.php
:
Run php artisan
command to see the new commands in the generate:*
section
Usage
- Models
- Views
- Controllers
- Migrations
- Pivot Tables
- Database Seeders
- Resource
- Repository
- Contract
- Notifications
- Events and Listeners
- Trait
- Job
- Console
- Middleware
- Factory
- Test
- File
- Configuration
Models
Views
Controllers
- The
Controller
postfix will be added if needed.
Migrations
This is very similar as Jeffrey Way's
Pivot Tables
This is very similar as Jeffrey Way's
Database Seeders
- The
TableSeeder
suffix will be added if needed.
Resource
- This will generate a Bar model, BarsController, resources views (in config), create_bars_table migration, BarTableSeeder
- In the config there is a
resource_views
array, you can specify the views that you want to generate there, just make sure the stub exist. - This will also ask you to generate the 'repository - contract pattern' files.
- The
--controller=admin
allows you to use the controller_admin stub when generating the controller.
Repository
This will generate a Posts Repository file to be used in your controller.
Contract
This will generate a Cache Contract file to be used with your repositories.
Notifications
This will generate a UserRegistered notification. Laravel provides support for sending notifications across a variety of delivery channels, including mail, SMS (via Nexmo), and Slack. Notifications may also be stored in a database so they may be displayed in your web interface.
Events and Listeners
This will generate the event and listener. Laravel's events provides a simple observer implementation, allowing you to subscribe and listen for various events that occur in your application
php artisan generate:event-listener
Will generate all the missing events and listeners defined in your EventServiceProvider.
Trait
This will generate a FooBar Trait file. The command will use the name as your namespace.
generate:trait Foo
will create a file in app/Foo.php
, generate:trait Foo\Bar
will create a file in app/Foo/Bar.php
.
Job
This will generate a SendReminderEmail Job file.
Console (Artisan Command)
This will generate a SendEmails Artisan Command file. The --command option is optional.
Middleware
This will generate an AuthenticateAdmin Middleware file.
Factory
This will generate a PostFactory model file.
Test
This will generate Feature\UserCanLogin and Unit\PostTest and Unit\Auth\LoginTest files.
Configuration
This will copy the config file to /config/generators.php
.
Here you can change the defaults for the settings of each type
, like model, view, controller, seed.
You can also change the namespace, path where to create the file, the pre/post fix, and more.
You can also add new stubs.
This will also copy all the stubs to /resources/stubs/
.
Here you can make changes to the current stubs, add your own boilerplate / comments to the files.
You can also add your own stubs here and specify it in the config to be used.
Migration Stub Note: The migration.stub
is only the outer part and the schema_create.stub or schema_change.stub
is where you modify the schema itself. The schema_create.stub
has boilerplate added to it.
File
This is the base command for the view, model, controller, seed commands.
The migration and migration:pivot uses Jeffrey's classes.
In the config there is a settings
array, this is the 'types' and their settings. You can add more, for example, if you use repositories, you can add it here.
Shortcuts
Customizing file was created message to add support for ide opening the files
Make links for opening output.Add output_path_handler as a function to your config/generators.php.Example:
This will output a file schema uri which JetBrain Products (Intellij,Php Storm,Web Storm,...) then can open directly from your terminal.
Thank you
- Thank you Taylor Ottwell for Laravel.
- Thank you Jeffrey Way for the awesome resources at Laracasts.
My other Packages
- Notify Laravel Flash Notifications with icons and animations and with a timeout
- Alert A helper package to flash a bootstrap alert to the browser via a Facade or a helper function.
- Impersonate User This allows you to authenticate as any of your customers.
- Sluggable Provides a HasSlug trait that will generate a unique slug when saving your Laravel Eloquent model.