PHPackages                             erikaraujo/laravel-stubs - 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. erikaraujo/laravel-stubs

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

erikaraujo/laravel-stubs
========================

Opinionated Laravel stubs with resources

1.0.1(5y ago)083MITPHPPHP ^7.4|^8.0CI failing

Since Apr 16Pushed 5y agoCompare

[ Source](https://github.com/erikaraujo/laravel-stubs)[ Packagist](https://packagist.org/packages/erikaraujo/laravel-stubs)[ Docs](https://github.com/erikaraujo/laravel-stubs)[ RSS](/packages/erikaraujo-laravel-stubs/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

Opinionated Laravel stubs with resources for API and InertiaJs
==============================================================

[](#opinionated-laravel-stubs-with-resources-for-api-and-inertiajs)

Main stub changes:

- controllers don't extend a base `Controller`;
- depending on the parameters passed, this also adds resources for controllers;
- migrations don't have a `down` function;
- model has `with` and `fillable` by default;
- docblocks have been removed;

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

[](#installation)

Install the package via composer:

```
composer require erikaraujo/laravel-stubs --dev
```

If you want to keep your stubs up to date with every update, add this composer hook to your composer.json file:

```
"scripts": {
    "post-update-cmd": [
        "@php artisan erikaraujo-stub:publish --force"
    ]
}
```

\*note that this has a `force` parameter, which will make the new stubs overwrite the existing ones on the stubs folder.

Usage
-----

[](#usage)

Publish the stubs using this `artisan` command:

```
php artisan erikaraujo-stub:publish
```

### Options

[](#options)

1. `--force`

```
php artisan erikaraujo-stub:publish --softdeletes
```

Unless you use `--force`, none of the existing stubs inside the `./stubs` folder will be replaced.

2. `--softdeletes`

```
php artisan erikaraujo-stub:publish --softdeletes
```

This will automatically add the `SoftDeletes` trait to your model stubs, add `$table->softdeletes()` to your migration stubs and add `forceDelete()` and `restore()` methods to the controllers.

3. `--inertia`

```
php artisan erikaraujo-stub:publish --inertia
```

This will import `Inertia\Inertia` to all your non-api controller stubs by default as well as add resources to the controllers methods (if a model is provided).

Resource example:

```
public function index()
{
    return Inertia::render('{{ model }}/Index', [
        '{{ modelVariable }}' => {{ model }}::paginate()->onEachSide(1),
    ]);
}
```

4. `--json`

```
php artisan erikaraujo-stub:publish --json
```

This will add resources to all your api controllers and return a json response with the correct HTTP response code.

Resource example:

```
public function index()
{
    ${{ modelVariable }} = {{ model }}::all();

    return response()->json([
        'data' => ${{ modelVariable }},
        'total' => ${{ modelVariable }}->count(),
    ], 200);
}
```

5. Multiple You can mix and match these options and everything will be applied correctly. All examples below are fine:

```
php artisan erikaraujo-stub:publish --inertia --softdeletes
```

```
php artisan erikaraujo-stub:publish --json --softdeletes
```

```
php artisan erikaraujo-stub:publish --json --inertia --softdeletes
```

```
php artisan erikaraujo-stub:publish --json --inertia --softdeletes --force
```

Testing
-------

[](#testing)

TODO: Add testing to cover all possible mix and match scenarios.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

For now, just create a PR and I'll take a look.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

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 ~0 days

Total

2

Last Release

1853d ago

### Community

Maintainers

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

---

Top Contributors

[![erikaraujo](https://avatars.githubusercontent.com/u/16599401?v=4)](https://github.com/erikaraujo "erikaraujo (2 commits)")

---

Tags

inertiajslaravel-stubserikaraujo

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/erikaraujo-laravel-stubs/health.svg)

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

###  Alternatives

[spatie/laravel-stubs

Opinionated Laravel stubs

252616.9k3](/packages/spatie-laravel-stubs)[robertboes/inertia-breadcrumbs

Laravel package to automatically share breadcrumbs to Inertia

56129.1k](/packages/robertboes-inertia-breadcrumbs)[boxybird/inertia-wordpress

The WordPress adapter for Inertia.js

1827.4k](/packages/boxybird-inertia-wordpress)

PHPackages © 2026

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