Installation

# Requirements

To use MoonShine, the following requirements must be met before installation:

  • php >= 8.1
  • laravel >= 10.23
  • composer > 2

# Composer

composer require moonshine/moonshine

# Installation

php artisan moonshine:install

Once executed, a config/moonshine.php with basic settings will be added.
More information about the configuration file

A directory with the administration panel and resources will also be added - app/MoonShine.
More about Resources

And a MoonShineServiceProvider provider will also be added, where resources should be registered.
More about Resources

# Creating an administrator

If during the installation of the admin panel MoonShine an administrator was not created or it is necessary to create another one, you can do it by executing the console command.

php artisan moonshine:user

# Service provider

To register new resources in MoonShine and create a menu, we need app/Providers/MoonShineServiceProvider.php

namespace App\Providers;
 
use MoonShine\Menu\MenuGroup;
use MoonShine\Menu\MenuItem;
use MoonShine\Providers\MoonShineApplicationServiceProvider;
use MoonShine\Resources\MoonShineUserResource;
use MoonShine\Resources\MoonShineUserRoleResource;
 
class MoonShineServiceProvider extends MoonShineApplicationServiceProvider
{
protected function resources(): array
{
return [
];
}
 
protected function menu(): array
{
return [
MenuGroup::make('moonshine::ui.resource.system', [
MenuItem::make('moonshine::ui.resource.admins_title', new MoonShineUserResource())
->translatable(),
MenuItem::make('moonshine::ui.resource.role_title', new MoonShineUserRoleResource())
->translatable(),
])->translatable(),
 
MenuItem::make('Documentation', 'https://laravel.com')
->badge(fn() => 'Check'),
];
}
 
protected function theme(): array
{
return [];
}
}

Once installed, several resources will be registered in the MoonShineServiceProvider.
More about Menu .

Great! Now you can create and register sections of the future admin panel and get to work! But don't forget to read the documentation to the end!

By default, the admin panel can be accessed by url /admin.
You can change the url in configuration file .