> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lunarphp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Installing the lunarphp/admin Filament panel, or plugging lunarphp/filament into an existing Filament v5 panel.

## Requirements

* PHP 8.4+
* Laravel 12 or 13
* Filament v5
* Lunar core installed and migrated — see [Installation](/2.x/getting-started/setup/installation)

## The turnkey panel: `lunarphp/admin`

```sh theme={null}
composer require lunarphp/admin
```

The package's service provider is auto-discovered, but the panel itself is not registered automatically. Register it from the `register()` method of a service provider:

```php theme={null}
use Lunar\Admin\Support\Facades\LunarPanel;

class AppServiceProvider extends ServiceProvider
{
    public function register(): void
    {
        LunarPanel::register();
    }
}
```

By default the panel is served at `/admin`, registered as the application's default Filament panel with the id `lunar`, and authenticates against Lunar's staff guard (`lunar.staff.guard`, default `staff`).

Publish the panel's compiled assets:

```sh theme={null}
php artisan filament:assets
```

<Note>
  Running the core installer, `php artisan lunar:install`, performs these steps automatically — it publishes assets and creates the first admin account when none exists.
</Note>

### Creating a staff account

```sh theme={null}
php artisan lunar:create-admin
```

This prompts for a name, email, and password, and creates a staff member with full admin rights. The command also accepts `--firstname`, `--lastname`, `--email`, and `--password` options for non-interactive use. It ships with Lunar core, so the same command works whichever panel package is installed.

### Customizing the panel

`LunarPanel::panel()` accepts a closure that receives the underlying `Filament\Panel`, so any standard Filament panel configuration applies. Chain it — and every other configuration call — **before** `register()`, and always return the panel from the closure:

```php theme={null}
use Filament\Panel;
use Lunar\Admin\Support\Facades\LunarPanel;

LunarPanel::panel(
    fn (Panel $panel) => $panel->path('backoffice')
)->register();
```

### Two-factor authentication

App-based (TOTP) two-factor authentication with recovery codes is enabled by default, as an optional feature each staff member can set up on their profile. To require it for every staff member:

```php theme={null}
LunarPanel::forceTwoFactorAuth()->register();
```

To remove two-factor authentication entirely (not recommended for production):

```php theme={null}
LunarPanel::disableTwoFactorAuth()->register();
```

### Branding

Publish the panel's public assets and replace the logo files to rebrand without any code:

```sh theme={null}
php artisan vendor:publish --tag=public
```

This copies `lunar-logo.svg`, `lunar-logo-dark.svg`, and `lunar-icon.png` into `public/vendor/lunarpanel/`, where the panel picks them up in place of the bundled defaults. Colors, fonts, and the brand name are changed through the `panel()` closure using Filament's standard `colors()`, `font()`, and `brandName()` methods.

<Warning>
  `LunarPanel::register()` applies some Filament defaults globally — table pagination options, full-width layout sections, and trimmed text inputs via `configureUsing()`. If the application runs a second, unrelated Filament panel, those defaults apply there too.
</Warning>

## The bridge in an existing panel: `lunarphp/filament`

An application that already has its own Filament v5 panel does not need `lunarphp/admin`. The bridge package plugs Lunar's building blocks into any panel:

```sh theme={null}
composer require lunarphp/filament
```

```php theme={null}
use Lunar\Filament\LunarPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugin(LunarPlugin::make()->fullPreset());
}
```

`fullPreset()` enables every feature group. They can also be toggled individually:

```php theme={null}
LunarPlugin::make()
    ->widgets()             // the seven order/customer dashboard widgets
    ->livewireComponents(); // the collection tree view component
```

`widgets()` registers Lunar's dashboard widgets (order stats, order totals, sales, average order value, new vs. returning customers, popular products, and latest orders) onto the panel; `widgets(false)` skips them, and passing an array of widget classes appends extras alongside the defaults. `livewireComponents()` does the same for the bridge's Livewire components, currently the collection tree view.

The rest of the bridge — entity selectors, form schemas, tables, relation managers, actions, and global-search descriptors — is a class library rather than something the plugin switches on. Panels use those classes directly; see [Extending](/2.x/addons/filament/extending) for the catalog.
