PHPackages                             mr-vaco/moonshine.settings.plugin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mr-vaco/moonshine.settings.plugin

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mr-vaco/moonshine.settings.plugin
=================================

2.0.2(3mo ago)2145↓50%1MITPHP

Since Jul 14Pushed 3mo agoCompare

[ Source](https://github.com/MrVACO/moonshine.settings.plugin)[ Packagist](https://packagist.org/packages/mr-vaco/moonshine.settings.plugin)[ Docs](https://github.com/MrVACO/moonshine.settings.plugin)[ RSS](/packages/mr-vaco-moonshinesettingsplugin/feed)WikiDiscussions 2.x Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (6)Used By (0)

Service "Settings" for Moonshine Admin Panel (Laravel)
======================================================

[](#service-settings-for-moonshine-admin-panel-laravel)

Simplest storage of settings in the database

MoonshinePackage version3+1.x4+2.xInstallation
------------

[](#installation)

```
composer require mr-vaco/moonshine.settings.plugin
```

```
php artisan migrate
```

How to use
----------

[](#how-to-use)

When entering the data, the data type (string / integer / boolean / array / json) is automatically determined and the last entered type is used - data obtaining `$settings->value`.

You can indicate any type of indicated, but keep in mind that when you call `$settings->value` will receive only the value specified in the "type" column.

### Get data

[](#get-data)

```
use MoonShine\Contracts\Core\DependencyInjection\CoreContract;
use MoonShine\Crud\JsonResponse;
use MoonShine\Laravel\Pages\Page;
use MoonShine\Laravel\TypeCasts\ModelCaster;
use MoonShine\Support\Attributes\AsyncMethod;
use MoonShine\Support\Enums\ToastType;
use MoonShine\UI\Components\FormBuilder;
use MrVaco\Moonshine\Settings\Models\Settings;
use MrVaco\Moonshine\Settings\SettingsService;

class ExamplePage extends Page
{
    /*
     * Necessarily! indicate the key to identification
     * You can specify any string value
     */
    protected string $settingsKey = 'example_key';
    protected array $settings = [];

    public function __construct(CoreContract $core, protected SettingsService $settingsService)
    {
        parent::__construct($core);

        $settings = $this->settingsService->get($this->settingsKey);
        $this->settings['data'] = $settings->value ?? null;
    }

    protected function components(): iterable
    {
        return [
            FormBuilder::make()
                ->fillCast($this->settings, new ModelCaster(Settings::class))
                ->fields([
                    Grid::make([
                        Column::make([
                            Fieldset::make('', [
                                Text::make(__('Site Name'), 'data.site.name'),

                                Text::make(__('Short name'), 'data.site.shortname'),

                                Text::make(__('Slogan'), 'data.site.slogan'),
                            ]),
                        ], colSpan: 4),
                    ]),
                ])
        ];
    }
}
```

### Save data

[](#save-data)

```
use MoonShine\Contracts\Core\DependencyInjection\CoreContract;
use MoonShine\Crud\JsonResponse;
use MoonShine\Laravel\Pages\Page;
use MoonShine\Laravel\TypeCasts\ModelCaster;
use MoonShine\Support\Attributes\AsyncMethod;
use MoonShine\Support\Enums\ToastType;
use MoonShine\UI\Components\FormBuilder;
use MrVaco\Moonshine\Settings\Models\Settings;
use MrVaco\Moonshine\Settings\SettingsService;

class ExamplePage extends Page
{
    protected string $settingsKey = 'example_key';
    protected array $settings = [];

    public function __construct(CoreContract $core, protected SettingsService $settingsService)
    {
        parent::__construct($core);

        $settings = $this->settingsService->get($this->settingsKey);
        $this->settings['data'] = $settings->value ?? null;
    }

    protected function components(): iterable
    {
        return [
            FormBuilder::make()
                ->asyncMethod('store')
                ->fillCast($this->settings, new ModelCaster(Settings::class))
                ->fields([
                    Grid::make([
                        Column::make([
                            Fieldset::make('', [
                                Text::make(__('Site Name'), 'data.site.name'),

                                Text::make(__('Short name'), 'data.site.shortname'),

                                Text::make(__('Slogan'), 'data.site.slogan'),
                            ]),

                            Fieldset::make(__('Phones'), [
                                Json::make('', 'data.phones')
                                    ->fields([
                                        Text::make("Number", 'number')
                                            ->placeholder('9 999 999 99 99'),

                                        Text::make("Mask", 'mask')
                                            ->placeholder('+9 (999) 999-99-99'),
                                    ])
                                    ->creatable(
                                        button: ActionButton::make(__('moonshine::ui.add'))->icon('plus')
                                    )
                                    ->removable(),
                            ]),
                        ], colSpan: 4),

                        Column::make([
                            Fieldset::make(__('Addition'), [
                                Json::make('', 'data.company.additions')
                                    ->fields([
                                        Text::make('Decryption', 'decryption'),

                                        Text::make('Value', 'value'),
                                    ])
                                    ->creatable(
                                        button: ActionButton::make(__('moonshine::ui.add'))->icon('plus')
                                    )
                                    ->reorderable()
                                    ->removable(),
                            ]),
                        ], colSpan: 4),
                    ]),
                ])
        ];
    }

    #[AsyncMethod]
    public function store(): JsonResponse
    {
        $message = __('moonshine::ui.saved');
        $type = ToastType::SUCCESS;

        try
        {
            $this->settingsService->set($this->settingsKey, request()->input('data'));
        } catch (\Exception $e)
        {
            info($e->getMessage());
            $message = __('moonshine::ui.saved_error');
            $type = ToastType::ERROR;
        }

        return JsonResponse::make()->toast($message, type: $type);
    }
}
```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance79

Regular maintenance activity

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~38 days

Recently: every ~16 days

Total

6

Last Release

112d ago

Major Versions

1.x-dev → 2.02025-11-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/18bc47ad15ecd7c99e49da8554139f73ef842c1880a133dee25b3323c216acbb?d=identicon)[Mr.VACO](/maintainers/Mr.VACO)

---

Top Contributors

[![MrVACO](https://avatars.githubusercontent.com/u/10116170?v=4)](https://github.com/MrVACO "MrVACO (11 commits)")

### Embed Badge

![Health badge](/badges/mr-vaco-moonshinesettingsplugin/health.svg)

```
[![Health](https://phpackages.com/badges/mr-vaco-moonshinesettingsplugin/health.svg)](https://phpackages.com/packages/mr-vaco-moonshinesettingsplugin)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
