Download the PHP package bouda/laravel-make-pattern without Composer

On this page you can find all versions of the php package bouda/laravel-make-pattern. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-make-pattern

Laravel Make Pattern

Latest Version on Packagist Tests Total Downloads

Generate a complete, working CRUD scaffold from one Artisan command — Model, Migration, Factory, Repository (+ interface), Service, Controller, Form Requests, API Resource, Policy and a Feature test, wired together with a container binding and a route.

The generated test passes immediately, because the scaffold is connected: the repository interface is bound in the container, the policy is registered, and the controller is routed.

Table of contents

Why

Writing the same repository/service/controller boilerplate for every resource gets old fast, and copy-pasting an existing module invites drift between resources.

Most Laravel scaffolders are either too minimal (model + migration) or hard-code an architecture you may not use. Two things make this one different:

Requirements

Installation

The service provider is auto-discovered — nothing to register manually.

On Laravel 11+, routes/api.php doesn't exist until you run php artisan install:api. Run it before generating: install:api silently refuses to wire the file into bootstrap/app.php if it already exists, so the generator deliberately never creates it — it tells you to run install:api and skips route registration instead. Everything else is still generated.

Usage

Preview without writing anything:

What gets generated

Plus two idempotent edits:

PatternServiceProvider is the piece that makes the scaffold work. It accumulates one entry per entity:

New entries are inserted above the marker comments. The rest of the file is yours — running the command again never duplicates an entry or overwrites your edits.

Options

Option Description
--only=model,service Generate only these layers
--except=test,migration Generate everything except these layers
--domain=Blog Group all layers under a domain (DDD style)
--namespace=Acme Override the root namespace (default: App)
--path=src Directory the overridden root namespace maps to
--force Overwrite existing files (the originals are backed up)
--dry-run Print what would be written, write nothing

An unknown layer name is an error, not a silent no-op. Valid layer names are the keys of the layers array in the config: model, migration, factory, repository_interface, repository, service, controller, store_request, update_request, resource, policy, test.

Domain (DDD) mode

Each layer's directory is derived from its namespace, so path and namespace can never drift apart: everything stays PSR-4 autoloadable.

Two details that matter in domain mode, and that the generator handles for you:

Rename the Domain segment (or drop it) in the config:

Custom root namespace

--path defaults to a lowercased mirror of the namespace (Acme → acme/). Only the primary root moves; Tests\ and Database\Factories\ stay where they are. The command reminds you to add the namespace to the psr-4 map in composer.json.

Combine with --domain:

Configuration

Published to config/make-pattern.php.

Roots

Every layer namespace sits under a PSR-4 root. This is what keeps paths and namespaces in sync.

Key Meaning
path The directory this namespace maps to in composer.json
domain prefix → App\Domain\Blog\Services, suffix → Tests\Feature\Blog, none → ignore --domain
primary The single root that --namespace rewrites

Everything else

Key Description Default
layers.*.enabled Generate this layer or not true
layers.*.namespace PSR-4 namespace; the directory is derived from it Laravel conventions
layers.*.stub Stub name per layer
layers.*.suffix Appended to the entity name to form the class name per layer
primary_key.strategy ulid, uuid or increment — drives the model traits, the migration column and the $id type hints ulid
tenancy.enabled / tenancy.driver Adds the driver's trait to the model. Drivers are declarable in tenancy.drivers false / stancl
wrap_repository_calls Wrap repository writes in try/catch + Log::error(), rethrowing. Uses the repository-with-logging stub false
policies.enforce_in_controller Controller calls Gate::authorize() in every action. Uses the controller-authorized stub true
provider.enabled Maintain PatternServiceProvider true
provider.class Its fully qualified name App\Providers\PatternServiceProvider
provider.auto_register Add it to bootstrap/providers.php true
routes.enabled / routes.file Register a resource route for the controller true / routes/api.php
routes.method apiResource or resource apiResource
routes.middleware e.g. ['auth:sanctum'] []
user_model Imported by the generated policy; null for no type hint App\Models\User
base_controller Extended by the generated controller; null to extend nothing App\Http\Controllers\Controller
history.path / history.backups / history.keep Where runs and backups are stored, and how many to keep storage/app/make-pattern/…, 50

Overriding the stubs

A published stub always wins over the packaged one, so you can override a single layer without touching the rest.

Every stub receives:

Placeholder Example
{{ namespace }}, {{ class }} App\Services, PostService
{{ entity }}, {{ entityVariable }}, {{ entitySnake }} Post, post, post
{{ entityTable }}, {{ routeUri }} posts, posts
{{ idType }} string or int, from the primary key strategy
{{ <layer>Fqcn }}, {{ <layer>Class }}, {{ <layer>Namespace }} {{ repositoryInterfaceFqcn }} → App\Repositories\Contracts\PostRepositoryInterface

Layer placeholders are generated from the config, so a layer you add yourself gets its own set automatically. Cross-layer references are built from the resolved targets, which is why a stub still imports the right class under --domain.

Feature flags select a stub variant before falling back to the base name, so publishing repository-with-logging.stub or controller-authorized.stub overrides just that variant.

History, undo and backups

Every run is recorded in storage/app/make-pattern/history.json:

Undo is content-aware:

Backups live in storage/app/make-pattern/backups/{run-id}/ and are pruned along with the history (history.keep, default 50 runs).

Logging

Technical output goes to the standard Log facade, separate from the history above:

To keep generator noise out of laravel.log, define a make-pattern channel in config/logging.php; the package picks it up automatically.

Testing

Tests run against Orchestra Testbench, so no full Laravel app is needed.

Upgrading from 0.2

Version 0.3 is a breaking release.

Changelog

See CHANGELOG.md.

Contributing

Issues and pull requests are welcome. Please run composer test before submitting a PR.

Security

If you discover a security issue, please open a GitHub issue rather than a public PR with exploit details.

Credits

License

The MIT License (MIT). See LICENSE for more information.


All versions of laravel-make-pattern with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^11.0|^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bouda/laravel-make-pattern contains the following files

Loading the files please wait ...