├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── composer.json ├── src ├── StubPublishCommand.php └── StubServiceProvider.php └── stubs ├── cast.inbound.stub ├── cast.stub ├── console.stub ├── controller.api.stub ├── controller.invokable.stub ├── controller.model.api.stub ├── controller.model.stub ├── controller.nested.api.stub ├── controller.nested.stub ├── controller.plain.stub ├── controller.stub ├── event.stub ├── factory.stub ├── job.queued.stub ├── job.stub ├── mail.stub ├── markdown-mail.stub ├── markdown-notification.stub ├── middleware.stub ├── migration.create.stub ├── migration.stub ├── migration.update.stub ├── model.pivot.stub ├── model.stub ├── notification.stub ├── observer.plain.stub ├── observer.stub ├── policy.plain.stub ├── policy.stub ├── provider.stub ├── request.stub ├── resource-collection.stub ├── resource.stub ├── rule.stub ├── scope.stub ├── seeder.stub ├── test.stub ├── test.unit.stub └── view-component.stub /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | composer.lock -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [3.4.1] - 2023-01-16 4 | 5 | ### Fixed 6 | 7 | - Update middleware return type declaration. 8 | 9 | ## [3.4.0] - 2022-11-05 10 | 11 | ### Changed 12 | 13 | - Add void return type declaration to migration stubs. 14 | 15 | ## [3.3.1] - 2022-10-28 16 | 17 | ### Fixed 18 | 19 | - Fix mail stub. 20 | 21 | ## [3.3.0] - 2022-10-28 22 | 23 | ### Changed 24 | 25 | - Update mail stubs to new syntax. 26 | 27 | ## [3.2.1] - 2022-07-27 28 | 29 | ### Fixed 30 | 31 | - Update middleware return type declaration. 32 | - Add `guarded` property back to model. 33 | 34 | ## [3.2.0] - 2022-06-26 35 | 36 | ### Added 37 | 38 | - Inbound cast stub. 39 | - Scope stub. 40 | - View component stub. 41 | 42 | ### Changed 43 | 44 | - Update console stub. 45 | - Add `authorize` method to request stub. 46 | - Specify response type in middleware stub. 47 | - Sort imports. 48 | - Add placeholder for seeder namespace. 49 | 50 | ## [3.1.0] - 2022-06-26 51 | 52 | ### Changed 53 | 54 | - Remove `guarded` property from model stub. 55 | 56 | ## [3.0.0] - 2022-02-18 57 | 58 | ### Added 59 | 60 | - Laravel 9 support. 61 | 62 | ## [2.6.0] - 2021-11-18 63 | 64 | ### Changed 65 | 66 | - Update console stub handle method return value. 67 | - Update controller stubs type declarations. 68 | - Remove factory stub model definition. 69 | - Add `ShouldBeUnique` import to queued job stub. 70 | - Remove `Queueable` trait from job stub. 71 | - Add type declarations to middleware stub. 72 | - Add method calls to down method in create and update migration stubs. 73 | - Add return type declarations to policy stub. 74 | - Add type declarations to resource collection stub. 75 | - Add type declarations to resource stub. 76 | - Update rule stub type declarations. 77 | 78 | ## [2.5.0] - 2021-11-16 79 | 80 | ### Added 81 | 82 | - Cast stub. 83 | - Event stub. 84 | - Mail stub. 85 | - Markdown mail stub. 86 | - Notification stub. 87 | - Markdown notification stub. 88 | - Observer stub. 89 | - Plain observer stub. 90 | - Service provider stub. 91 | 92 | ### Changed 93 | 94 | - Update migration stubs to include down method. 95 | 96 | ## [2.4.0] - 2021-11-16 97 | 98 | ### Changed 99 | 100 | - Update migration stubs to use anonymous migrations. 101 | 102 | ## [2.3.0] - 2020-11-30 103 | 104 | ### Added 105 | 106 | - PHP 8 support. 107 | 108 | ## [2.2.0] - 2020-10-21 109 | 110 | ### Added 111 | 112 | - Make model attributes unguarded. 113 | 114 | ## [2.1.0] - 2020-09-24 115 | 116 | ### Changed 117 | 118 | - Update test stub. 119 | - Update unit test stub. 120 | 121 | ## [2.0.1] - 2020-09-10 122 | 123 | ### Fixed 124 | 125 | - Update factory stub with upstream fix. 126 | 127 | ## [2.0.0] - 2020-09-09 128 | 129 | ### Added 130 | 131 | - Laravel 8 support. 132 | - Resource stub. 133 | - Resource collection stub. 134 | 135 | ### Changed 136 | 137 | - Update console stub. 138 | - Update factory stub. 139 | - Update model stub. 140 | - Update seeder stub. 141 | 142 | ## [1.1.0] - 2020-05-06 143 | 144 | ### Added 145 | 146 | - CHANGELOG file. 147 | 148 | ### Changed 149 | 150 | - README hook snippet. 151 | - Collapse empty arrays. 152 | 153 | ## [1.0.0] - 2020-05-04 154 | 155 | ### Added 156 | 157 | - Customized stubs. 158 | 159 | [3.4.1]: https://github.com/zepfietje/laravel-stubs/releases/tag/3.4.1 160 | [3.4.0]: https://github.com/zepfietje/laravel-stubs/releases/tag/3.4.0 161 | [3.3.1]: https://github.com/zepfietje/laravel-stubs/releases/tag/3.3.1 162 | [3.3.0]: https://github.com/zepfietje/laravel-stubs/releases/tag/3.3.0 163 | [3.2.1]: https://github.com/zepfietje/laravel-stubs/releases/tag/3.2.1 164 | [3.2.0]: https://github.com/zepfietje/laravel-stubs/releases/tag/3.2.0 165 | [3.1.0]: https://github.com/zepfietje/laravel-stubs/releases/tag/3.1.0 166 | [3.0.0]: https://github.com/zepfietje/laravel-stubs/releases/tag/3.0.0 167 | [2.6.0]: https://github.com/zepfietje/laravel-stubs/releases/tag/2.6.0 168 | [2.5.0]: https://github.com/zepfietje/laravel-stubs/releases/tag/2.5.0 169 | [2.4.0]: https://github.com/zepfietje/laravel-stubs/releases/tag/2.4.0 170 | [2.3.0]: https://github.com/zepfietje/laravel-stubs/releases/tag/2.3.0 171 | [2.2.0]: https://github.com/zepfietje/laravel-stubs/releases/tag/2.2.0 172 | [2.1.0]: https://github.com/zepfietje/laravel-stubs/releases/tag/2.1.0 173 | [2.0.1]: https://github.com/zepfietje/laravel-stubs/releases/tag/2.0.1 174 | [2.0.0]: https://github.com/zepfietje/laravel-stubs/releases/tag/2.0.0 175 | [1.1.0]: https://github.com/zepfietje/laravel-stubs/releases/tag/1.1.0 176 | [1.0.0]: https://github.com/zepfietje/laravel-stubs/releases/tag/1.0.0 177 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Zep Fietje 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Packagist Version](https://img.shields.io/packagist/v/zepfietje/laravel-stubs)](https://packagist.org/packages/zepfietje/laravel-stubs) 2 | [![Packagist Downloads](https://img.shields.io/packagist/dt/zepfietje/laravel-stubs)](https://packagist.org/packages/zepfietje/laravel-stubs/stats) 3 | 4 | # Laravel Stubs 5 | 6 | This package contains clean versions of the stubs shipped with Laravel. 7 | Most notably: 8 | 9 | - Type declarations are used instead of DocBlocks. 10 | - Controllers don't extend a base controller. 11 | 12 | ## Installation 13 | 14 | 1. Install this package: 15 | ```bash 16 | composer require zepfietje/laravel-stubs --dev 17 | ``` 18 | 2. Add the following hook to the scripts in `composer.json` to keep your stubs in sync with updates to this package: 19 | ```json 20 | "post-update-cmd": [ 21 | "@php artisan stub:publish --force" 22 | ] 23 | ``` 24 | 3. Publish the stubs: 25 | ```bash 26 | php artisan stub:publish 27 | ``` 28 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "zepfietje/laravel-stubs", 3 | "description": "Clean versions of the stubs shipped with Laravel.", 4 | "keywords": [ 5 | "laravel", 6 | "stubs" 7 | ], 8 | "homepage": "https://github.com/zepfietje/laravel-stubs", 9 | "license": "MIT", 10 | "authors": [ 11 | { 12 | "name": "Zep Fietje", 13 | "homepage": "https://zepfietje.com" 14 | } 15 | ], 16 | "require": { 17 | "php": "^8.0", 18 | "laravel/framework": "^9.0" 19 | }, 20 | "require-dev": { 21 | "phpunit/phpunit": "^9.3" 22 | }, 23 | "autoload": { 24 | "psr-4": { 25 | "ZepFietje\\Stubs\\": "src" 26 | } 27 | }, 28 | "autoload-dev": { 29 | "psr-4": { 30 | "ZepFietje\\Stubs\\Tests\\": "tests" 31 | } 32 | }, 33 | "extra": { 34 | "laravel": { 35 | "providers": [ 36 | "ZepFietje\\Stubs\\StubServiceProvider" 37 | ] 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/StubPublishCommand.php: -------------------------------------------------------------------------------- 1 | laravel->basePath('stubs'))) { 19 | (new Filesystem)->makeDirectory($stubsPath); 20 | } 21 | 22 | collect(File::files(__DIR__.'/../stubs'))->each(function (SplFileInfo $file) use ($stubsPath) { 23 | $from = $file->getPathname(); 24 | $to = "$stubsPath/{$file->getFilename()}"; 25 | 26 | if (! file_exists($to) || $this->option('force')) { 27 | file_put_contents($to, file_get_contents($from)); 28 | } 29 | }); 30 | 31 | $this->info('Stubs published successfully.'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/StubServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->runningInConsole()) { 13 | $this->commands([ 14 | StubPublishCommand::class, 15 | ]); 16 | } 17 | } 18 | 19 | public function provides() 20 | { 21 | return [ 22 | StubPublishCommand::class, 23 | ]; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /stubs/cast.inbound.stub: -------------------------------------------------------------------------------- 1 | markdown('{{ view }}'); 26 | } 27 | 28 | public function toArray(mixed $notifiable): array 29 | { 30 | return []; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /stubs/middleware.stub: -------------------------------------------------------------------------------- 1 | id(); 13 | $table->timestamps(); 14 | }); 15 | } 16 | 17 | public function down(): void 18 | { 19 | Schema::dropIfExists('{{ table }}'); 20 | } 21 | }; 22 | -------------------------------------------------------------------------------- /stubs/migration.stub: -------------------------------------------------------------------------------- 1 | line('The introduction to the notification.') 27 | ->action('Notification Action', url('/')) 28 | ->line('Thank you for using our application!'); 29 | } 30 | 31 | public function toArray(mixed $notifiable): array 32 | { 33 | return []; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /stubs/observer.plain.stub: -------------------------------------------------------------------------------- 1 |