Repository navigation
Artisan Console
Artisan is the command-line interface included with Laravex. It lives at lib/laravex/console/kernel.ex and is invoked through the artisan Mix alias (or directly via mix artisan). Every command is wired to a handler function in Laravex.Console.Kernel.
./artisan list
./artisan serve
./artisan serve --port=4000The full command map is defined in the @commands module attribute of Laravex.Console.Kernel. Commands are sorted alphabetically when printed by list.
| Command | Description |
|---|---|
about |
Display basic application information (env, debug, APP_KEY status, Elixir/OTP versions) |
down |
Put the application into maintenance mode |
down --message="…" |
Set a custom maintenance message |
down --retry=N |
Set the Retry-After seconds |
down --secret=… |
Allow bypass with a secret URL segment |
up |
Bring the application out of maintenance mode |
env |
Display current .env values (sensitive keys are redacted) |
env --only=KEY |
Display a single env key |
inspire |
Display an inspiring quote |
key:generate |
Generate and write APP_KEY to .env
|
key:generate --force |
Overwrite an existing key |
list |
List all registered commands |
serve |
Start the development HTTP server on port 8000 |
serve --port=N |
Start on a custom port |
test |
Run the test suite via mix test
|
tinker |
Open an interactive Elixir REPL bound to your application |
| Command | Description |
|---|---|
config:cache |
Serialise configuration into bootstrap/cache/config.term
|
config:clear |
Remove the configuration cache |
optimize |
Run config:cache, route:cache, event:cache, and view:cache together |
optimize:clear |
Remove all cached bootstrap files |
| Command | Description |
|---|---|
db:seed |
Run Database.Seeders.DatabaseSeeder.run/0
|
db:show |
List all tables in the database |
db:show {table} |
Show columns and types for a specific table |
db:wipe |
Drop all tables |
migrate |
Run pending migrations |
migrate:fresh |
Drop all tables and re-run all migrations |
migrate:refresh |
Roll back and re-run all migrations |
migrate:rollback |
Roll back the last batch of migrations |
migrate:status |
Show which migrations have been run |
model:show {Model} |
Inspect a model's table, fillable fields, casts, relations, and columns |
| Command | Description |
|---|---|
event:cache |
Write the event → listener map to bootstrap/cache/events.term
|
event:clear |
Remove the cached events file |
event:list |
Print all registered events and their listeners |
See Events for details.
| Command | Description |
|---|---|
queue:batch {id} |
Show details for a job batch |
queue:batch cancel {id} |
Cancel a pending batch |
queue:batches |
List all job batches |
queue:failed |
List all failed queue jobs |
queue:flush |
Delete all failed jobs |
queue:forget {id|uuid} |
Delete a single failed job |
queue:retry {id|uuid} |
Push a failed job back onto the queue |
queue:work |
Process jobs continuously |
queue:work --once |
Process a single job then exit |
See Queues for details.
| Command | Description |
|---|---|
route:cache |
Compile and cache the route collection |
route:clear |
Remove the route cache |
route:list |
Print all registered routes (method, URI, name) |
route:match {method} {uri} |
Show which route matches the given method and URI |
view:cache |
Pre-compile Blade templates |
view:clear |
Remove compiled view files |
| Command | Description |
|---|---|
sanctum:prune-expired |
Delete expired API tokens |
| Command | Description |
|---|---|
schedule:list |
List all scheduled tasks with their cron expressions |
schedule:run |
Execute any tasks that are due right now |
See Task-Scheduling for details.
| Command | Description |
|---|---|
storage:link |
Create symbolic links defined in filesystems.links
|
See File-Storage for details.
Artisan includes a generator for every common scaffold. Each command creates a file from a template in lib/laravex/generators.ex.
| Command | Signature | Output |
|---|---|---|
make:command |
Name |
app/Console/Commands/{name}.ex |
make:controller |
Name |
app/Http/Controllers/{name}.ex |
make:event |
Name |
app/Events/{name}.ex |
make:factory |
Name |
database/factories/{name}.ex |
make:job |
Name |
app/Jobs/{name}.ex |
make:listener |
Name [--event=Event] |
app/Listeners/{name}.ex |
make:mail |
Name |
app/Mail/{name}.ex |
make:middleware |
Name |
app/Http/Middleware/{name}.ex |
make:migration |
name |
database/migrations/{timestamp}_{name}.ex |
make:model |
Name |
app/Models/{name}.ex |
make:notification |
Name |
app/Notifications/{name}.ex |
make:policy |
Name |
app/Policies/{name}.ex |
make:provider |
Name |
app/Providers/{name}.ex |
make:request |
Name |
app/Http/Requests/{name}.ex |
make:resource |
Name [--collection|-c] |
app/Http/Resources/{name}.ex (Resource or ResourceCollection) |
make:observer |
Name |
app/Observers/{name}.ex |
make:enum |
Name |
app/Enums/{name}.ex |
make:rule |
Name |
app/Rules/{name}.ex |
make:seeder |
Name |
database/seeders/{name}.ex |
./artisan make:model Post
./artisan make:controller PostController
./artisan make:listener SendWelcomeEmail --event=UserRegistered
./artisan make:migration create_posts_table
./artisan make:resource UserResource
./artisan make:resource UserCollection --collectionThe install:* commands scaffold optional feature groups.
| Command | Description |
|---|---|
install:api |
Create routes/api.ex with a bearer-token-authenticated /api/user endpoint |
install:broadcasting |
Create routes/channels.ex and config/broadcasting.exs
|
install:starter-kit |
Scaffold login, forgot-password, and reset-password views, routes, and controller |
./artisan install:broadcasting
./artisan install:starter-kitRegister a custom command in any Service-Providers or in routes/console.ex using Laravex.Console.Router.command/3:
Laravex.Console.Router.command("emails:send", "Send marketing emails", fn ctx ->
ctx.writeln.("Sending…")
App.Jobs.SendMarketingEmails.dispatch_sync()
ctx.writeln.("Done.")
end)The handler receives a map with:
-
args— the list of CLI arguments that followed the command name -
writeln— afn binary -> :ok endthat writes a line to stdout
Custom commands appear in artisan list alongside built-in ones.
artisan tinker opens a lightweight Elixir REPL (IEx-style) with the application fully booted. Exit by typing exit or quit.
./artisan tinker
>>> Laravex.Cache.Manager.get("my_key")
nil
>>> App.Models.User.all()
[%App.Models.User{...}]
>>> exit
Note: Tinker evaluates expressions with
Code.eval_string/2. Each line is a standalone evaluation; bindings from previous lines are carried forward in the session.
-
Task-Scheduling —
schedule:runandschedule:list -
Queues —
queue:work,queue:failed, and batch commands -
Events —
event:listandevent:cache
Laravex — Laravel-faithful application skeleton & runtime for Elixir.
GitHub
·
Docs
·
Limitations
·
Laravel Docs
Not affiliated with Laravel LLC or the Elixir core team. Built to feel like Laravel on the BEAM.
- Home
- Installation
- Configuration
- Directory-Structure
- Request-Lifecycle
- Service-Container
- Service-Providers
- Deployment
- Routing
- Middleware
- CSRF-Protection
- Controllers
- Requests
- Responses
- Views
- Blade-Templates
- Asset-Bundling
- Session
- Validation
- Error-Handling
- Logging
- Artisan-Console
- Broadcasting
- Cache
- Collections
- Events
- File-Storage
- Helpers
- HTTP-Client
- Localization
- Notifications
- Pipeline
- Queues
- Rate-Limiting
- Strings
- Task-Scheduling