layman/laravel-architect

Laravel package for generating controllers, requests, models, and repositories from configuration.

Maintainers

Package info

github.com/cc-layman/laravel-architect

pkg:composer/layman/laravel-architect

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-06-18 09:31 UTC

This package is auto-updated.

Last update: 2026-06-18 09:34:05 UTC


README

Generate Laravel controllers, form requests, models, and repositories from config/architect.php. Generated controllers use spatie/laravel-route-attributes by default.

Installation

Install the package in a Laravel application:

composer require layman/laravel-architect

Laravel package discovery registers Layman\LaravelArchitect\ArchitectServiceProvider automatically.

Publishing

Publish the config file:

php artisan vendor:publish --tag=architect-config

Publish the default stubs if you want to customize generated code:

php artisan vendor:publish --tag=architect-stubs

By default, published stubs are copied to artisan-generator-stubs.

Usage

Generate all configured artifacts:

php artisan architect:make User

Generate selected artifact types:

php artisan architect:make User --only=controller --only=request

Overwrite existing generated files:

php artisan architect:make User --force

Nested module names are supported:

php artisan architect:make Admin/User

Use {{modulePath}} in config/architect.php paths if nested module names should also affect output namespaces.

Configuration

config/architect.php controls namespaces and generated files:

'namespace' => [
    'controller' => 'App\Http\Controllers',
    'request' => 'App\Http\Requests',
    'repository' => 'App\Repositories',
    'model' => 'App\Models',
],

'template' => [
    'files' => [
        'controller' => [
            'path' => 'Backend',
            'name' => '{{module}}Controller',
            'stub' => 'controller.stub',
        ],
    ],
],

Supported placeholders include {{module}}, {{module_snake}}, {{module_kebab}}, {{module_camel}}, {{module_plural}}, {{module_plural_snake}}, {{table}}, and {{variable}}.

The default controller stub adds #[Prefix('{{module_snake}}')], uses #[Post(...)] for every action, and sets #[Defaults('description', '')].