Download the PHP package erikaraujo/laravel-stubs without Composer
On this page you can find all versions of the php package erikaraujo/laravel-stubs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download erikaraujo/laravel-stubs
More information about erikaraujo/laravel-stubs
Files in erikaraujo/laravel-stubs
Package laravel-stubs
Short Description Opinionated Laravel stubs with resources
License MIT
Homepage https://github.com/erikaraujo/laravel-stubs
Informations about the package laravel-stubs
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
andfillable
by default; - docblocks have been removed;
Installation
Install the package via composer:
If you want to keep your stubs up to date with every update, add this composer hook to your composer.json file:
*note that this has a force
parameter, which will make the new stubs overwrite the existing ones on the stubs folder.
Usage
Publish the stubs using this artisan
command:
Options
--force
Unless you use --force
, none of the existing stubs inside the ./stubs
folder will be replaced.
--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.
--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:
--json
This will add resources to all your api controllers and return a json response with the correct HTTP response code.
Resource example:
- Multiple You can mix and match these options and everything will be applied correctly. All examples below are fine:
Testing
TODO: Add testing to cover all possible mix and match scenarios.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
For now, just create a PR and I'll take a look.