Dev Commands

Webisters Dev Commands ships ready-made CLI commands for the work you do during local development: running migrations, listing routes, dumping a table, seeding fixtures, starting a dev server, and more. Add the library to your project and they appear under your webisters binary alongside your own commands.

Installation

composer require --dev webisters/dev-commands

Registering the commands

The commands are PSR-4 autoloaded under Framework\CLI\Commands\. Register the namespace with your console kernel:

use Framework\CLI\Console;

$console->addCommandsByNamespace('Framework\\CLI\\Commands');

If you scaffolded your project from the App or API template, the commands are pre-registered.

Database commands

Run the standard migration lifecycle from the CLI:

webisters migrate:up        # apply all pending migrations
webisters migrate:down      # roll back the last batch
webisters migrate:to 2024_01_15_000001  # migrate to a specific version

webisters seed              # run seeders
webisters list-schemas      # list every schema known to the configured connections
webisters show-schema users # describe one schema
webisters show-table users  # render a table's contents in the terminal
webisters query "SELECT * FROM users LIMIT 5"

Routing commands

webisters routes            # tabular list of every registered route
webisters make-routes       # regenerate route attribute cache

Dev server

Start a local dev server with preloading, watching, and logging enabled:

webisters start

Stop it with Ctrl+C.

Conclusion

Anything you find yourself running ten times a day during development is a candidate for becoming a command. Lean on the existing ones, then add your own following the same pattern in CLI.

Did you find something wrong? Be sure to let us know with an issue. Thank you!