PHP code example of bouda / laravel-make-pattern
1. Go to this page and download the library: Download bouda/laravel-make-pattern library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bouda / laravel-make-pattern example snippets
protected array $repositories = [
\App\Repositories\Contracts\PostRepositoryInterface::class => \App\Repositories\PostRepository::class,
// make-pattern:repositories
];
protected array $policies = [
\App\Models\Post::class => \App\Policies\PostPolicy::class,
// make-pattern:policies
];
'domain' => ['segment' => 'Modules'], // App\Modules\Blog\Services
'roots' => [
'App' => ['path' => app_path(), 'domain' => 'prefix', 'primary' => true],
'Tests' => ['path' => base_path('tests'), 'domain' => 'suffix'],
'Database\\Factories' => ['path' => database_path('factories'), 'domain' => 'suffix'],
],
'channels' => [
'make-pattern' => [
'driver' => 'single',
'path' => storage_path('logs/make-pattern.log'),
'level' => 'info',
],
],
text
app/Models/Post.php
app/Repositories/Contracts/PostRepositoryInterface.php
app/Repositories/PostRepository.php
app/Services/PostService.php
app/Http/Controllers/PostController.php
app/Http/Requests/PostStoreRequest.php
app/Http/Requests/PostUpdateRequest.php
app/Http/Resources/PostResource.php
app/Policies/PostPolicy.php
app/Providers/PatternServiceProvider.php ← created once, appended to afterwards
database/migrations/2026_08_30_101500_create_posts_table.php
database/factories/PostFactory.php
tests/Feature/PostTest.php
text
app/Domain/Blog/Models/Post.php
app/Domain/Blog/Repositories/Contracts/PostRepositoryInterface.php
app/Domain/Blog/Repositories/PostRepository.php
app/Domain/Blog/Services/PostService.php
app/Domain/Blog/Http/Controllers/PostController.php
app/Domain/Blog/Http/Requests/PostStoreRequest.php
app/Domain/Blog/Http/Resources/PostResource.php
app/Domain/Blog/Policies/PostPolicy.php
tests/Feature/Blog/PostTest.php
database/factories/Blog/PostFactory.php
database/migrations/..._create_posts_table.php ← migrations stay global
bash
php artisan make:pattern Post --namespace=Acme --path=src
# => src/Models/Post.php with namespace Acme\Models
bash
php artisan make:pattern Post --domain=Blog --namespace=Acme
# => Acme\Domain\Blog\Models\Post
bash
php artisan vendor:publish --tag=make-pattern-stubs