---
title: "Artisan commands — Options for Laravel | Roundly"
description: "Eight commands to scaffold options and groups, list, get and set values, clear caches, and export or import settings."
url: https://roundly-consulting.com/open-source/docs/options-for-laravel/commands
language: en
---

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

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

# Artisan commands

```bash
php artisan make:option ThemeOption --cast=string --key=theme --encrypted --enum="App\Enums\Status"
php artisan make:option-group AppearanceSettings --options="App\Options\ThemeOption,App\Options\LocaleOption"
php artisan options:list   [--owner=App\Models\User --owner-id=5]
php artisan options:get    {option} [--owner= --owner-id= --as=<userKey>]
php artisan options:set    {option} {value} [--owner= --owner-id= --json --as=<userKey>]
php artisan options:clear-cache
php artisan options:export [--owner= --owner-id= --path=storage/options.json]
php artisan options:import {path}
```

| Command | What it does |
| --- | --- |
| `make:option` | Scaffold an option class in app/Options. --key, --cast, --encrypted and --enum fill in the stub. |
| `make:option-group` | Scaffold an OptionGroup in app/Settings; --options pre-fills the member list, each class fully qualified. |
| `options:list` | Table of registered keys with readable name and resolved value, optionally for an owner. Warns when the registry is empty. |
| `options:get` | Print the resolved value. Arrays and objects print as JSON, booleans as true / false. |
| `options:set` | Persist a value; --json decodes it as JSON first — invalid JSON fails the command and stores nothing. |
| `options:clear-cache` | Flush the in-request memo and the persistent cache — works on every store. |
| `options:export` | Export stored options as JSON to stdout, or to a file with --path. |
| `options:import` | Upsert options from a JSON export file. |

{option} is a registered key or an option class-string. --owner takes a model class and needs --owner-id. An unknown option, an invalid owner class, a missing --owner-id or one that names no record, a value the option’s rules() refuse, denied access and any other package error print a message and exit with status 1 — never a stack trace.

## Examples

```bash
php artisan options:set theme dark
php artisan options:set theme light --owner="App\Models\User" --owner-id=5
php artisan options:set notification-preferences '{"email":true,"sms":false}' --json
php artisan options:get theme --owner="App\Models\User" --owner-id=5
php artisan options:list --owner="App\Models\User" --owner-id=5
```

options:list shows only registered keys, so register the options you want to inspect. make:option-group writes each --options class fully qualified (\\App\\Options\\ThemeOption::class), so it resolves from the group’s own namespace. The commands bypass access control; options:get and options:set accept --as to run under a user’s rules (see Access control).

## 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/options-for-laravel.md)
