---
title: "Artisan commands — Lifecycle for Laravel | Roundly"
description: "make:lifecycle, sweep, graph, validate, show, adopt and prune — signatures, options and when to run each."
url: https://roundly-consulting.com/open-source/docs/lifecycle-for-laravel/commands
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Lifecycle for Laravel](https://roundly-consulting.com/open-source/docs/lifecycle-for-laravel.md)

# Artisan commands

Seven commands cover generating, running, inspecting and maintaining lifecycles:

| Command | What it does |
| --- | --- |
| `make:lifecycle {name} {--enum=} {--force}` | Generates a definition class in App\\Lifecycles: a small valid example, or the cases of a backed enum as states (starting in the first case). vendor:publish --tag=lifecycle-stubs lets you edit the stubs. |
| `lifecycle:sweep {--limit=} {--queue} {--no-warnings} {--database=}` | Sends due warnings and runs due expiries and scheduled transitions of one connection’s package tables (the default, or --database). Isolatable. |
| `lifecycle:graph {definition} {--format=mermaid\|dot} {--output=}` | Prints or writes a graph. definition is a definition class or Model:attribute (class name or morph alias). An --output path it cannot write exits 1. |
| `lifecycle:validate {definition?*} {--strict}` | Lists every error and warning; for Model:attribute also checks that the named columns exist and that rate-limit keys fit 250 characters (rate\_limit\_key\_too\_long). Without arguments: every lifecycle of every model in lifecycle.subjects. Warns when a definition has expiries or system transitions but lifecycle:sweep is not scheduled — for a model on another connection, lifecycle:sweep --database=<connection>. |
| `lifecycle:show {subject} {id} {--lifecycle=} {--history=10}` | One subject’s state, entry time, version, freeze, expiry, what the system could do next, and recent history. A NULL lifecycle column shows as not initialised. |
| `lifecycle:adopt {model} {--lifecycle=} {--chunk=500} {--no-expiry}` | Reconciles every row of a model (missing records, drift, NULL states). |
| `lifecycle:prune {--history-days=} {--schedule-days=} {--dry-run} {--database=}` | Deletes old history rows and finished schedules (defaults from config); --database prunes another connection’s package tables. |

```bash
php artisan make:lifecycle ListingLifecycle --enum="App\Enums\ListingStatus"
php artisan lifecycle:sweep --limit=1000 --queue
php artisan lifecycle:sweep --database=tenant
php artisan lifecycle:validate --strict
php artisan lifecycle:show "App\Models\Listing" 42 --history=20
php artisan lifecycle:adopt "App\Models\Order" --no-expiry
php artisan lifecycle:prune --history-days=365 --schedule-days=30 --dry-run
```

- subject and model arguments resolve through your morph map first, then as a class name, and must name a LifecycleSubject model.
- lifecycle:sweep belongs in the scheduler, every minute — once per database connection your subjects use (--database). It is isolatable and prints the SweepResult. A sweep scheduled as a closure or job counts for about and lifecycle:validate when it is named lifecycle:sweep.
- lifecycle:validate exits 1 on errors — or, with --strict, on warnings, when nothing is configured to validate, or when a definition needs lifecycle:sweep but it is not scheduled. Run it in CI.
- lifecycle:adopt skips trashed rows and is safe to run repeatedly. With --no-expiry, adopted TTL states get no expiry schedule — useful for a large legacy table that would otherwise expire at the next sweep.
- lifecycle:prune --dry-run only counts. With nothing configured, nothing is pruned.

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/lifecycle-for-laravel.md)
