PHPackages                             brnbio/laravel-crud - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. brnbio/laravel-crud

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

brnbio/laravel-crud
===================

Custom code generator

1.1.1(2y ago)018MITPHP

Since Jun 13Pushed 2y ago1 watchersCompare

[ Source](https://github.com/brnbio/laravel-crud)[ Packagist](https://packagist.org/packages/brnbio/laravel-crud)[ RSS](/packages/brnbio-laravel-crud/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (5)Used By (0)

Code generation for Laravel
===========================

[](#code-generation-for-laravel)

This lib helps to generate code for Laravel projects.

### Installation

[](#installation)

```
composer require --dev brnbio/laravel-crud
```

If you want your own templates, make sure you publish the stubs to your application.

```
php artisan stub:publish
```

### Macroable

[](#macroable)

If you want to add your own replacements, you can easy update the replacements. All basic replacements, command arguments and options are available.

```
// AppServiceProvider.php

GenerateRequestCommand::macro('updateReplace', function (array $replace, array $arguments, array $options) {
    return array_merge($replace, [
        // your replacements
    ]);
});
```

### Basic replacements

[](#basic-replacements)

- `{{ namespace }}` - Namespace for generated class
- `{{ rootNamespace }}` - Base namespace
- `{{ class }}` - Class name
- `{{ namespacedModel }}` - Namespaced model class
- `{{ model }}` - Name of the model
- `{{ modelVariable }}` - Variable name for the model
- `{{ modelVariablePlural }}` - Variable name for the model in plural

```
// e.g. for a Team model

$replace = [
    'namespace' => 'App\Models',
    'rootNamespace' => 'App',
    'class' => 'Team',
    'namespacedModel' => 'App\Models\Team',
    'model' => 'Team',
    'modelVariable' => 'team',
    'modelVariablePlural' => 'teams',
];
```

### Usage

[](#usage)

Generate everything for model `Team`: Model, Controller, Views, Requests and Migration.

```
php artisan generate --table=teams --attributes=name:string Team
```

If you want to do it manually, you can use the basic commands to generate.

#### Generate model

[](#generate-model)

In addition to the basic replacements, the following replacements are available for the request:

- `{{ table }}` - Table name (if set by option)
- `{{ attributes }}` - List of the attribute constants
- `{{ fillable }}` - List of the fillable attributes
- `{{ properties }}` - List of the properties based on the attributes for the doc block

```
php artisan generate:model --table teams --attributes=name:string Team
```

```
// generated fields

/**
 * Class Team
 *
 * @package App\Models
 * @property string $name
 */
class Team extends Model
{
    public const TABLE = 'teams';
    public const ATTRIBUTE_NAME = 'name';

    /**
     * @var string[]
     */
    protected $fillable = [
        self::ATTRIBUTE_NAME,
    ];
}
```

#### Generate migration

[](#generate-migration)

In addition to the basic replacements, the following replacements are available for the request:

- `{{ fields }}` - List of table fields based on the attributes

```
php artisan generate:migration --create teams --attributes=name:string CreateTeamsTable
```

```
// generated fields

Schema::create('teams', function (Blueprint $table) {
    // ...
    $table->string('name');
    // ...
});
```

#### Generate controller

[](#generate-controller)

In addition to the basic replacements, the following replacements are available for the request:

- `{{ storeRequest }}` - Store request class
- `{{ namespacedStoreRequest }}` - Store request class with namespace
- `{{ updateRequest }}` - Update request class
- `{{ namespacedUpdateRequest }}` - Update request class with namespace

```
php artisan generate:controller --model=Team --type=create Teams/CreateController
```

```
// generated controller

class CreateController extends Controller
{
    /**
     * @return Response
     */
    public function __invoke(): Response
    {
        return inertia('teams/create');
    }

    /**
     * @param StoreRequest $request
     * @return RedirectResponse
     */
    public function store(StoreRequest $request): RedirectResponse
    {
        $team = Team::create($request->validated());

        return to_route('teams.details', compact('team'));
    }
}
```

#### Generate view

[](#generate-view)

```
php artisan generate:view --model Team --type create teams/create
```

```
// generated view

import { useForm } from '@inertiajs/inertia-vue3';
import { provide } from 'vue';

const form = useForm({
    //
});
provide('form');

function submit() {
    form.submit(route('teams.create'));
}

        // ...

            Submit

```

#### Generate request

[](#generate-request)

In addition to the basic replacements, the following replacements are available for the request:

- `{{ rules }}` - List of rules based on the attributes

```
php artisan generate:request --model Team --attributes=name:string Teams/StoreRequest
```

```
// generated rules

public function rules(): array
{
    return [
        Team::ATTRIBUTE_NAME => [
            'required',
            'string',
            'max:255',
        ],
    ];
}
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~64 days

Total

4

Last Release

870d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c6be756807583b215be4ea02be78e37aefbeb1d1b1054787ae63fc0b2fdfdafa?d=identicon)[fheider](/maintainers/fheider)

---

Top Contributors

[![fheider](https://avatars.githubusercontent.com/u/3755151?v=4)](https://github.com/fheider "fheider (32 commits)")

### Embed Badge

![Health badge](/badges/brnbio-laravel-crud/health.svg)

```
[![Health](https://phpackages.com/badges/brnbio-laravel-crud/health.svg)](https://phpackages.com/packages/brnbio-laravel-crud)
```

###  Alternatives

[simple-updates/phpwhois

This package contains a Whois (RFC954) library for PHP. It allows a PHP program to create a Whois object, and obtain the output of a whois query with the Lookup function.

251.4k](/packages/simple-updates-phpwhois)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
