PHPackages                             innonazarene/prism-init - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. innonazarene/prism-init

ActiveLibrary[HTTP &amp; Networking](/categories/http)

innonazarene/prism-init
=======================

Laravel Artisan command to scaffold models, services, controllers, requests, resources, policies and API routes from your database.

v1.0.6(1mo ago)07↓100%MITPHPPHP ^8.1CI passing

Since Apr 23Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/innonazarene/prism)[ Packagist](https://packagist.org/packages/innonazarene/prism-init)[ RSS](/packages/innonazarene-prism-init/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (7)Versions (8)Used By (0)

Prism Init
==========

[](#prism-init)

[![CI](https://github.com/innonazarene/prism/actions/workflows/ci.yml/badge.svg)](https://github.com/innonazarene/prism/actions)[![Latest Version](https://camo.githubusercontent.com/d96e1827136f48b162fc62cebcb4263053f1d4ba17b23ec81a0ca5473aa87547/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696e6e6f6e617a6172656e652f707269736d2d696e69742e737667)](https://packagist.org/packages/innonazarene/prism-init)[![PHP](https://camo.githubusercontent.com/83dd395020c37276225039739320f6c8e7e99963ab21ee3d09282cb48dad2a60/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d626c7565)](https://php.net)[![Laravel](https://camo.githubusercontent.com/7570286bdea90802e5d11fea51625e5a17ae02a3f74b5d146c5de00125829e69/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d392d2d31332d464632443230)](https://laravel.com)[![License](https://camo.githubusercontent.com/dfa887e8cf9e2426f563abde87f7569630778da510905cba833d98b8078ff5fc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f696e6e6f6e617a6172656e652f707269736d)](LICENSE)

**Prism Init** scaffolds a complete, convention-following backend API from your existing database in one command.

---

What gets generated per table
-----------------------------

[](#what-gets-generated-per-table)

ArtifactPath (grouped, default)Eloquent Model`app/Models/Employee/Employee.php`Service`app/Services/Employee/EmployeeService.php`Controller`app/Http/Controllers/Api/V1/Employee/EmployeeController.php`Store Request`app/Http/Requests/Employee/StoreEmployeeRequest.php`Update Request`app/Http/Requests/Employee/UpdateEmployeeRequest.php`API Resource`app/Http/Resources/Employee/EmployeeResource.php`Policy`app/Policies/Employee/EmployeePolicy.php`API Routes`routes/api.php` — `Route::apiResource('employees', …)`**Plus, once:**

ArtifactPath`ApiResponse` Trait`app/Traits/ApiResponse.php`---

Conventions followed
--------------------

[](#conventions-followed)

### Database (3.3.1)

[](#database-331)

- Table names: `snake_case`, plural (`employees`, `salary_grades`)
- Model names: `PascalCase`, singular (`Employee`)
- Soft deletes: `deleted_at` on every model (configurable)
- Timestamps: `created_at`, `updated_at` on every model

### PHP / Laravel (3.3.2)

[](#php--laravel-332)

- **Models**: `PascalCase` singular, `$fillable`, `$casts`, `SoftDeletes` — columns auto-populated from DB
- **Controllers**: thin — validate → delegate to Service → return Resource
- **Services**: all business logic inside `DB::transaction()` where needed, `list()` returns paginated results
- **Requests**: `Store{Model}Request` / `Update{Model}Request` — validation rules inferred from DB column types
- **Resources**: `{Model}Resource` — all fields auto-populated from DB columns
- **Policies**: `{Model}Policy` with all standard gates stubbed
- **Response envelope**: consistent `{ success, data, message, errors }` via `ApiResponse` trait

---

Requirements
------------

[](#requirements)

PHP^8.1Laravel^10 | ^11 | ^12 | ^13---

Installation
------------

[](#installation)

```
composer require innonazarene/prism-init --dev
```

Publish the config if you want to customise defaults:

```
php artisan vendor:publish --tag=prism-init-config
```

Publish stubs to customise them (optional):

```
php artisan vendor:publish --tag=prism-init-stubs
# → published to stubs/prism-init/
```

---

Usage
-----

[](#usage)

```
php artisan prism:init
```

### Options

[](#options)

OptionDescription`--prefix=v1`Route prefix (default: `v1` → `/api/v1/…`)`--grouped`Force grouped folder structure`--flat`Force flat folder structure`--no-timestamps`Disable `$timestamps` on models`--no-soft-deletes`Skip `SoftDeletes` on models`--skip-migrate`Skip migration generation`--skip-seed`Skip seeding`--skip-services`Skip Service class generation`--skip-resources`Skip API Resource generation`--skip-policies`Skip Policy generation`--tables=users,products`Only scaffold listed tables`--force`Overwrite existing files### Examples

[](#examples)

```
# Full scaffold, version prefix v2
php artisan prism:init --prefix=v2

# Only two tables, flat structure
php artisan prism:init --tables=orders,products --flat

# Skip migrations and seeds (DB already set up)
php artisan prism:init --skip-migrate --skip-seed

# No soft deletes, no policies
php artisan prism:init --no-soft-deletes --skip-policies
```

---

Generated output example
------------------------

[](#generated-output-example)

Given a `departments` table, Prism Init produces:

**`app/Models/Department/Department.php`**

```
class Department extends Model
{
    use SoftDeletes;

    protected $table = 'departments';

    protected $fillable = [
        'name',
        'code',
        'description',
    ];

    protected $casts = [
        'deleted_at' => 'datetime',
    ];
}
```

**`app/Services/Department/DepartmentService.php`**

```
public function list(array $filters = []): LengthAwarePaginator
{
    $perPage = isset($filters['per_page']) ? (int) $filters['per_page'] : 15;

    return Department::query()
        ->latest()
        ->paginate($perPage);
}
```

**`app/Http/Controllers/Api/V1/Department/DepartmentController.php`**

```
class DepartmentController extends Controller
{
    use ApiResponse;

    public function __construct(
        private readonly DepartmentService $service
    ) {}

    public function index(Request $request): JsonResponse
    {
        $data = $this->service->list($request->all());
        return $this->successResponse(DepartmentResource::collection($data), 'Department list retrieved.');
    }

    // store / show / update / destroy …
}
```

**`app/Http/Requests/Department/StoreDepartmentRequest.php`**

```
public function rules(): array
{
    return [
        'name'        => 'required|string|max:255',
        'code'        => 'required|string|max:50',
        'description' => 'sometimes|nullable|string',
    ];
}
```

**`app/Http/Resources/Department/DepartmentResource.php`**

```
public function toArray(Request $request): array
{
    return [
        'id'          => $this->id,
        'name'        => $this->name,
        'code'        => $this->code,
        'description' => $this->description,
        'created_at'  => $this->created_at,
        'updated_at'  => $this->updated_at,
    ];
}
```

**`app/Traits/ApiResponse.php`** — envelope methods:

```
// Success:   { success: true,  data: T,    message: string, errors: null }
// Error:     { success: false, data: null, message: string, errors: object }
// Paginated: { success: true,  data: T[],  meta: { current_page, last_page, per_page, total }, … }
```

**`routes/api.php`**

```
use App\Http\Controllers\Api\V1\Department\DepartmentController;

Route::prefix('v1')->group(function () {
    Route::apiResource('departments', DepartmentController::class);
});
```

---

Customising stubs
-----------------

[](#customising-stubs)

After publishing stubs (`--tag=prism-init-stubs`), edit any file in `stubs/prism-init/`. Prism Init always prefers your published stub over the package default.

Available stubs:

StubPurpose`model.stub`Eloquent model`service.stub`Service class`controller.stub`API controller`Store-request.stub`Store Form Request`Update-request.stub`Update Form Request`resource.stub`API Resource`policy.stub`Policy`api-response.stub``ApiResponse` trait---

Optional Packages
-----------------

[](#optional-packages)

Prism Init detects these packages at runtime. If installed, they are used automatically — if not, the step is skipped with an install hint.

PackagePurpose[kitloong/laravel-migrations-generator](https://github.com/kitloong/laravel-migrations-generator)Generate migrations from existing DB[orangehill/iseed](https://github.com/orangehill/iseed)Generate seeders from live data---

Backup &amp; re-running
-----------------------

[](#backup--re-running)

On every run, Prism saves clean copies of `routes/api.php` and `Controller.php` to `public/backup/`and restores them before regenerating — so you always start from a clean slate.

---

Contributing
------------

[](#contributing)

Pull requests welcome. Please open an issue first to discuss changes.

```
git checkout -b feat/my-feature
# … make changes …
vendor/bin/phpunit
git push && open PR
```

---

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance92

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.6% 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 ~1 days

Total

7

Last Release

40d ago

### Community

Maintainers

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

---

Top Contributors

[![innonazarene](https://avatars.githubusercontent.com/u/18453732?v=4)](https://github.com/innonazarene "innonazarene (69 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

phpapilaravelrestscaffoldingcode generatorartisanbackend

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/innonazarene-prism-init/health.svg)

```
[![Health](https://phpackages.com/badges/innonazarene-prism-init/health.svg)](https://phpackages.com/packages/innonazarene-prism-init)
```

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

9782.1M153](/packages/laravel-ai)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k51.0M7.4k](/packages/larastan-larastan)[illuminate/queue

The Illuminate Queue package.

20432.2M1.5k](/packages/illuminate-queue)[api-platform/laravel

API Platform support for Laravel

59156.3k10](/packages/api-platform-laravel)[calebdw/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

15104.9k4](/packages/calebdw-larastan)[erag/laravel-lang-sync-inertia

A powerful Laravel package for syncing and managing language translations across backend and Inertia.js (Vue/React) frontends, offering effortless localization, auto-sync features, and smooth multi-language support for modern Laravel applications.

4721.5k](/packages/erag-laravel-lang-sync-inertia)

PHPackages © 2026

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