{"id":30605454,"url":"https://github.com/bpocallaghan/generators","last_synced_at":"2025-08-30T02:13:02.511Z","repository":{"id":29975363,"uuid":"33522388","full_name":"bpocallaghan/generators","owner":"bpocallaghan","description":"Laravel File Generators with config and publishable stubs","archived":false,"fork":false,"pushed_at":"2024-04-15T13:39:06.000Z","size":300,"stargazers_count":119,"open_issues_count":2,"forks_count":18,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-08-11T21:53:45.993Z","etag":null,"topics":["artisan","class","commands","database-seeder","file","generate","hacktoberfest","laravel","make","php","pivot-tables","publishable-stubs","stubs"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bpocallaghan.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"patreon":"bpocallaghan"}},"created_at":"2015-04-07T04:39:27.000Z","updated_at":"2025-03-04T23:21:28.000Z","dependencies_parsed_at":"2023-10-11T15:26:17.882Z","dependency_job_id":"907c325b-39cf-49f0-bd13-f75beacdd8a7","html_url":"https://github.com/bpocallaghan/generators","commit_stats":{"total_commits":220,"total_committers":3,"mean_commits":73.33333333333333,"dds":"0.018181818181818188","last_synced_commit":"a5f8e6eb2f8e4bbf5178a4ff18c696262756b2b3"},"previous_names":[],"tags_count":61,"template":false,"template_full_name":null,"purl":"pkg:github/bpocallaghan/generators","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpocallaghan%2Fgenerators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpocallaghan%2Fgenerators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpocallaghan%2Fgenerators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpocallaghan%2Fgenerators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bpocallaghan","download_url":"https://codeload.github.com/bpocallaghan/generators/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpocallaghan%2Fgenerators/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272793103,"owners_count":24993843,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["artisan","class","commands","database-seeder","file","generate","hacktoberfest","laravel","make","php","pivot-tables","publishable-stubs","stubs"],"created_at":"2025-08-30T02:12:57.333Z","updated_at":"2025-08-30T02:13:02.489Z","avatar_url":"https://github.com/bpocallaghan.png","language":"PHP","readme":"# Laravel File Generators\n\nCustom Laravel File Generators with a config file and publishable stubs.\nYou can publish the stubs. You can add your own stubs to generate.\n\nThis package is being used in [Admin Starter Project](https://github.com/bpocallaghan/titan-starter) that focuses on test driven development and has the foundation ready for you.\n\n```\nLaravel 5.1 : v2.1.3\nLaravel 5.2 - 5.3 : v3.0.3\nLaravel 5.4 : v4.1.9\nLaravel 5.5 - 5.8 : v5.0.0+\nLaravel 6.0 : v5.1.0+\nLaravel 7.0 : v6.x\nLaravel 8.0 : v7.x\nLaravel 9.0 : v8.x\nLaravel 10.0 : v9.x\n```\n\n## Commands\n```bash\nphp artisan generate:publish-stubs\nphp artisan generate:model\nphp artisan generate:view\nphp artisan generate:controller\nphp artisan generate:migration\nphp artisan generate:migration:pivot\nphp artisan generate:seed\nphp artisan generate:resource\nphp artisan generate:repository\nphp artisan generate:contract\nphp artisan generate:notification\nphp artisan generate:event\nphp artisan generate:listener\nphp artisan generate:event-listener\nphp artisan generate:trait\nphp artisan generate:job\nphp artisan generate:console\nphp artisan generate:middleware\nphp artisan generate:factory\nphp artisan generate:test\nphp artisan generate:file\nphp artisan generate:exception\nphp artisan generate:component\nphp artisan generate:livewire\n```\n\n### Option for all the commands\n - `--force` This will override the existing file, if it exists.\n - `--test` This will also generate a test file.\n\n### Option for all the commands, except `views` and `migration:pivot`\n - `--plain` This will use the .plain stub of the command (generate an empty controller)\n\n### Customization\nThis is for all except the `migration` and `migration:pivot` commands\n\n```\nphp artisan generate:file foo.bar --type=controller\nphp artisan generate:view foo.bar --stub=view_show --name=baz_show\nphp artisan generate:file foo.bar --type=controller --stub=controller_custom --name=BazzzController --plain --force\n```\n\nYou can specify a custom name of the file to be generated.\nYou can add the --plain or --force options.\nYou can override the default stub to be used.\nYou can create your own stubs with the available placeholders.\nYou can create new settings' types, for example:\n- 'exception' =\u003e ['namespace' =\u003e '\\Exceptions', 'path' =\u003e './app/Exceptions/', 'postfix' =\u003e 'Exception'],\n\n[Available placeholders](https://github.com/bpocallaghan/generators/blob/master/resources/stubs/example.stub)\n\n## Views Custom Stubs\n\n```\nphp artisan generate:view posts\nphp artisan generate:view admin.posts --stub=custom\nphp artisan generate:view admin.posts --stub=another_file\n```\n\n## Installation\n\nUpdate your project's `composer.json` file.\n\n```\ncomposer require bpocallaghan/generators --dev\n```\n\nAdd the Service Provider (Laravel 5.5+ has automatic discovery of packages)\nYou'll only want to use these generators for local development, add the provider in `app/Providers/AppServiceProvider.php`:\n\n```php\npublic function register()\n{\n    if ($this-\u003eapp-\u003eenvironment() == 'local') {\n        $this-\u003eapp-\u003eregister(\\Bpocallaghan\\Generators\\GeneratorsServiceProvider::class);\n    }\n}\n```\n\nRun `php artisan` command to see the new commands in the `generate:*` section\n\n## Usage\n\n- [Models](#models)\n- [Views](#views)\n- [Controllers](#controllers)\n- [Migrations](#migrations)\n- [Pivot Tables](#pivot-tables)\n- [Database Seeders](#database-seeders)\n- [Resource](#resource)\n- [Repository](#repository)\n- [Contract](#contract)\n- [Notifications](#notifications)\n- [Events and Listeners](#events-and-listeners)\n- [Trait](#trait)\n- [Job](#job)\n- [Console](#console)\n- [Middleware](#middleware)\n- [Factory](#factory)\n- [Test](#test)\n- [File](#file)\n- [Configuration](#configuration)\n\n### Models\n\n```\nphp artisan generate:model bar\nphp artisan generate:model foo.bar --plain\nphp artisan generate:model bar --force\nphp artisan generate:model bar --factory\nphp artisan generate:model bar --migration\nphp artisan generate:model bar --migration --schema=\"title:string, body:text\"\n```\n\n### Views\n\n```\nphp artisan generate:view foo\nphp artisan generate:view foo.bar\nphp artisan generate:view foo.bar --stub=view_show\nphp artisan generate:view foo.bar --name=foo_bar\n```\n\n### Controllers\n\n```\nphp artisan generate:controller foo\nphp artisan generate:controller foo.bar\nphp artisan generate:controller fooBar\nphp artisan generate:controller bar --plain\nphp artisan generate:controller BarController --plain\n```\n\n- The `Controller` postfix will be added if needed.\n\n\n### Migrations\n\nThis is very similar as [Jeffrey Way's](https://github.com/laracasts/Laravel-5-Generators-Extended)\n\n```\nphp artisan generate:migration create_users_table\nphp artisan generate:migration create_users_table --plain\nphp artisan generate:migration create_users_table --force\nphp artisan generate:migration create_posts_table --schema=\"title:string, body:text, slug:string:unique, published_at:date\"\n```\n\n### Pivot Tables\n\nThis is very similar as [Jeffrey Way's](https://github.com/laracasts/Laravel-5-Generators-Extended)\n\n```\nphp artisan generate:migration:pivot tags posts\n```\n\n### Database Seeders\n\n```\nphp artisan generate:seed bar\nphp artisan generate:seed BarTableSeeder\n```\n\n- The `TableSeeder` suffix will be added if needed.\n\n### Resource\n\n```\nphp artisan generate:resource bar\nphp artisan generate:resource foo.bar\nphp artisan generate:resource foo.bar_baz\nphp artisan generate:resource bar --schema=\"title:string, body:text, slug:string:unique, published_at:date\"\nphp artisan generate:resource articles --controller=admin\n```\n\n- This will generate a Bar model, BarsController, resources views (in config), create_bars_table migration, BarTableSeeder\n- 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.\n- This will also ask you to generate the 'repository - contract pattern' files.\n- The `--controller=admin` allows you to use the controller_admin stub when generating the controller.\n\n### Repository\n```\nphp artisan generate:repository Posts\n```\nThis will generate a Posts Repository file to be used in your controller.\n\n### Contract\n```\nphp artisan generate:contract Cache\n```\nThis will generate a Cache Contract file to be used with your repositories.\n\n### Notifications\n\n```\nphp artisan generate:notification UserRegistered\n```\n\nThis will generate a UserRegistered notification.\nLaravel 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.\n\n### Events and Listeners\n\n```\nphp artisan generate:event InvoiceWasPaid\nphp artisan generate:listener NotifyUserAboutPayment --event=InvoiceWasPaid\nphp artisan generate:event-listener\n```\nThis will generate the event and listener.\nLaravel's events provides a simple observer implementation, allowing you to subscribe and listen for various events that occur in your application\n\n`php artisan generate:event-listener `\nWill generate all the missing events and listeners defined in your EventServiceProvider.\n\n### Trait\n```\nphp artisan generate:trait Http\\Controllers\\Traits\\Bar\n```\nThis will generate a FooBar Trait file. The command will use the name as your namespace.\n`generate:trait Foo` will create a file in `app/Foo.php`, `generate:trait Foo\\Bar` will create a file in `app/Foo/Bar.php`.\n\n### Job\n```\nphp artisan generate:job SendReminderEmail\n```\nThis will generate a SendReminderEmail Job file.\n\n### Console (Artisan Command)\n```\nphp artisan generate:console SendEmails\nphp artisan generate:console SendEmails --command=send:emails\n```\nThis will generate a SendEmails Artisan Command file. The --command option is optional.\n\n### Middleware\n```\nphp artisan generate:middleware AuthenticateAdmin\n```\nThis will generate an AuthenticateAdmin Middleware file.\n\n### Factory\n```\nphp artisan generate:factory Post\nphp artisan generate:factory PostFactory\n```\nThis will generate a PostFactory model file.\n\n### Test\n```\nphp artisan generate:test UserCanLogin\nphp artisan generate:test Post --unit\nphp artisan generate:test Auth\\LoginTest\n```\nThis will generate Feature\\UserCanLogin and Unit\\PostTest and Unit\\Auth\\LoginTest files.\n\n### Component\n```\nphp artisan generate:component Foo\nphp artisan generate:component Foo/Bar\nphp artisan generate:component Baz --test\n```\nThis will generate a Laravel Component. The php and blade files will be generated.\nYou can also specify to generate a unit test.\n\n### Livewire\n```\nphp artisan generate:livewire Foo\nphp artisan generate:livewire Foo/Bar\nphp artisan generate:livewire Baz --test\nphp artisan generate:livewire foo-bar --request\n```\nThis will generate a Livewire component. The php and blade files will be generated.\nYou can also specify to generate a test or a form request.\n\n### Configuration\n\n```\nphp artisan generate:publish-stubs\n```\n\nThis will copy the config file to `/config/generators.php`.\nHere you can change the defaults for the settings of each `type`, like model, view, controller, seed.\nYou can also change the namespace, path where to create the file, the pre/post fix, and more.\nYou can also add new stubs.\n\nThis will also copy all the stubs to `/resources/stubs/`.\nHere you can make changes to the current stubs, add your own boilerplate / comments to the files.\nYou can also add your own stubs here and specify it in the config to be used.\n**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.\n\n### File\n\nThis is the base command for the view, model, controller, seed commands.\nThe migration and migration:pivot uses Jeffrey's classes.\nIn 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.\n\n```\nphp artisan generate:file foo.bar --type=view\nphp artisan generate:file foo.bar --type=controller\nphp artisan generate:file foo.bar --type=model\nphp artisan generate:file foo.bar --type=model --stub=model_custom\n```\n\n## Customizing file was created message to add support for ide opening the files\n\nMake links for opening output.\nAdd output_path_handler as a function to your config/generators.php.Example:\n\n```\n'output_path_handler' =\u003e static function($path){\n    return 'file:///' . base_path() . $path;\n},\n```\nThis will output a file schema uri which JetBrain Products (Intellij,Php Storm,Web Storm,...) then can open directly from your terminal.\n\n## Thank you\n\n- Thank you, [Taylor Ottwell](https://github.com/taylorotwell) for [Laravel](http://laravel.com/).\n- Thank you, [Jeffrey Way](https://github.com/JeffreyWay) for the awesome resources at [Laracasts](https://laracasts.com/).\n\n## My Other Packages\n\n- [Alert](https://github.com/bpocallaghan/alert) A helper package to flash a bootstrap alert to the browser via a Facade or a helper function.\n- [Notify](https://github.com/bpocallaghan/notify) Laravel Flash Notifications with icons and animations and with a timeout\n- [Impersonate User](https://github.com/bpocallaghan/impersonate) This allows you to authenticate as any of your customers.\n- [Sluggable](https://github.com/bpocallaghan/sluggable) Provides a HasSlug trait that will generate a unique slug when saving your Laravel Eloquent model.\n","funding_links":["https://patreon.com/bpocallaghan"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbpocallaghan%2Fgenerators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbpocallaghan%2Fgenerators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbpocallaghan%2Fgenerators/lists"}