PHPackages                             abdalhalem/statica - 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. abdalhalem/statica

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

abdalhalem/statica
==================

A Laravel package for managing dynamic application settings stored as structured JSON

07PHP

Since May 17Pushed 3w agoCompare

[ Source](https://github.com/abdalhalem-alfakhrany/statica)[ Packagist](https://packagist.org/packages/abdalhalem/statica)[ RSS](/packages/abdalhalem-statica/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Statica
=======

[](#statica)

[![Latest Stable Version](https://camo.githubusercontent.com/59fc82299875eb51a1e4d425ee257c1bd7e82554baa9342f3ce6747fec454665/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616264616c68616c656d2f73746174696361)](https://packagist.org/packages/abdalhalem/statica)[![License](https://camo.githubusercontent.com/51c65773818a47141759aaa6f3cffb5b545016ec09b47c8a7ef6ca9e0ef23ecc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f616264616c68616c656d2f73746174696361)](https://packagist.org/packages/abdalhalem/statica)[![Total Downloads](https://camo.githubusercontent.com/b93fd19ab0fdcaa1f4c4f4f66af73baaf1b130d1f24a92edeee6a70cb2eddca1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616264616c68616c656d2f73746174696361)](https://packagist.org/packages/abdalhalem/statica)

A Laravel package for managing dynamic application settings stored as structured JSON, with built-in Blade directives for rendering values and a built-in dashboard for editing them at runtime — no database required.

---

Features
--------

[](#features)

- Store settings as structured JSON on any Laravel filesystem disk
- Nested key support via dot notation (`app.brand.name`)
- Four entry types: single value, translatable value, list, and translatable list
- **Blade directives** for rendering settings directly in your views
- Built-in dashboard UI with inline editing and drag-and-drop list reordering
- Auto-creates missing keys with defaults on first use
- Per-entry meta labels for dashboard display (supports multiple locales)
- No database migrations required

---

Requirements
------------

[](#requirements)

- PHP **8.1+**
- Laravel **10.x** or **11.x**

---

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require abdalhalem/statica
```

Publish the config file:

```
php artisan vendor:publish --tag=statica-settings-config
```

Publish the dashboard assets:

```
php artisan vendor:publish --tag=statica-assets
```

Optionally publish the views if you want to customize the dashboard UI:

```
php artisan vendor:publish --tag=statica-views
```

---

Configuration
-------------

[](#configuration)

After publishing, the config file will be at `config/statica.php`:

```
return [

    /*
    |--------------------------------------------------------------------------
    | Repository Type
    |--------------------------------------------------------------------------
    |
    | The storage driver Statica will use to persist settings.
    | Currently supported: "JsonFile"
    |
    */
    'repository_type' => \Statica\SettingRepositoryType::JsonFile,

    /*
    |--------------------------------------------------------------------------
    | Filesystem Disk
    |--------------------------------------------------------------------------
    |
    | The filesystem disk where Statica will store the settings JSON file.
    | Set to null to use the default disk defined in config/filesystems.php.
    |
    */
    'disk' => env('STATICA_DISK', null),

    /*
    |--------------------------------------------------------------------------
    | Vite Dev Server
    |--------------------------------------------------------------------------
    |
    | Enable this during package development to load dashboard assets from
    | the Vite dev server instead of the published compiled files.
    |
    */
    'vite_dev' => env('STATICA_VITE_DEV', false),

];
```

### Environment Variables

[](#environment-variables)

```
STATICA_DISK=local
STATICA_VITE_DEV=false
```

---

Blade Directives
----------------

[](#blade-directives)

This is the primary way to use Statica in your views. Directives automatically create the setting with the given default if it does not exist yet, then output or iterate the value.

### `@settings` — Single Value

[](#settings--single-value)

Outputs a plain string setting. Creates it with the default if missing.

```
@settings('app.name', 'My Application')

{{-- with a dashboard display label --}}
@settings('app.name', 'My Application', ['label' => ['en' => 'App Name', 'ar' => 'اسم التطبيق']])
```

**Parameters:**

\#ParameterTypeDescription1`$key``string`Dot-notation key2`$default``string|null`Default value if key doesn't exist3`$meta``array`Optional. `['label' => ['en' => '...', 'ar' => '...']]` for dashboard display---

### `@translatable_settings` — Translatable Single Value

[](#translatable_settings--translatable-single-value)

Outputs the value for the **current application locale**. Creates it with the defaults if missing.

```
@translatable_settings('app.tagline', ['en' => 'Welcome', 'ar' => 'أهلاً'])

{{-- with a dashboard display label --}}
@translatable_settings('app.tagline', ['en' => 'Welcome', 'ar' => 'أهلاً'], ['label' => ['en' => 'Tagline', 'ar' => 'الشعار']])
```

**Parameters:**

\#ParameterTypeDescription1`$key``string`Dot-notation key2`$defaults``array``['locale' => 'value']` map of defaults3`$meta``array`Optional. `['label' => [...]]` for dashboard display---

### `@foreach_settings` — List

[](#foreach_settings--list)

Iterates over a list setting. Use `@endforeach_settings` to close the loop.

```
@foreach_settings('home.features', [['label' => 'Fast'], ['label' => 'Reliable']])
    {{ $__key['label'] }}
@endforeach_settings

{{-- with a dashboard display label --}}
@foreach_settings('home.features', [['label' => 'Fast']], ['label' => ['en' => 'Features', 'ar' => 'المميزات']])
    {{ $__key['label'] }}
@endforeach_settings
```

**Parameters:**

\#ParameterTypeDescription1`$key``string`Dot-notation key2`$defaults``array`Array of default list items3`$meta``array`Optional. `['label' => [...]]` for dashboard display---

### `@foreach_translatable_settings` — Translatable List

[](#foreach_translatable_settings--translatable-list)

Iterates over a list where each item's label is translatable. Outputs labels for the **current application locale**.

```
@foreach_translatable_settings('home.services', [
    ['label' => ['en' => 'Design', 'ar' => 'تصميم']],
    ['label' => ['en' => 'Development', 'ar' => 'تطوير']],
])
    {{ $__iterator['label'] }}
@endforeach_settings
```

With a custom iterator variable name and meta:

```
@foreach_translatable_settings(
    'home.services',
    [['label' => ['en' => 'Design', 'ar' => 'تصميم']]],
    ['label' => ['en' => 'Services', 'ar' => 'الخدمات']],
    'service'
)
    {{ $service['label'] }}
@endforeach_settings
```

**Shorthand** — if you don't need defaults or meta, pass just the key and iterator name:

```
@foreach_translatable_settings('home.services', 'service')
    {{ $service['label'] }}
@endforeach_settings
```

**Parameters:**

\#ParameterTypeDescription1`$key``string`Dot-notation key2`$defaults` or `$iterator``array|string`Defaults array, or iterator name if skipping defaults3`$meta``array`Optional. `['label' => [...]]` for dashboard display4`$iterator``string`Optional. Variable name for each item in the loop---

### `@endforeach_settings`

[](#endforeach_settings)

Closes both `@foreach_settings` and `@foreach_translatable_settings` loops.

```
@foreach_settings('home.features', [...])
    {{-- loop body --}}
@endforeach_settings
```

---

Entry Types
-----------

[](#entry-types)

TypeBlade DirectivePHP EnumSingle string`@settings``SettingEntryType::Single`Translatable string`@translatable_settings``SettingEntryType::SingleTranslatable`List`@foreach_settings``SettingEntryType::List`Translatable list`@foreach_translatable_settings``SettingEntryType::ListTranslatable`---

PHP API
-------

[](#php-api)

You can also interact with settings directly via the `SettingsService` class, which is bound as a singleton in the container.

### Resolving the Service

[](#resolving-the-service)

```
use Statica\SettingsService;

// via dependency injection
public function index(SettingsService $settings) { ... }

// via the container
$settings = app(SettingsService::class);
```

### `getValue`

[](#getvalue)

```
// single value
$value = $settings->getValue('app.name');

// translatable value for a specific locale
$value = $settings->getValue('app.tagline', 'en', SettingEntryType::SingleTranslatable);

// list
$list = $settings->getValue('home.features', null, SettingEntryType::List);

// translatable list for a specific locale
$list = $settings->getValue('home.services', 'ar', SettingEntryType::ListTranslatable);
```

### `setValue`

[](#setvalue)

```
$settings->setValue('app.name', 'My App');

$settings->setValue('app.tagline', 'Welcome', 'en', SettingEntryType::SingleTranslatable);

$settings->setValue('home.features', ['label' => 'Fast'], null, SettingEntryType::List);

// persist to disk
$settings->updateData();
```

### `getOrCreate`

[](#getorcreate)

Retrieves a value if it exists, or creates it with the given default and persists it:

```
$value = $settings->getOrCreate('app.name', 'My App');

$value = $settings->getOrCreate('app.tagline', [
    'en' => 'Welcome',
    'ar' => 'أهلاً',
], type: SettingEntryType::SingleTranslatable);
```

### `setLabel`

[](#setlabel)

Sets the dashboard display label for a key:

```
$settings->setLabel('app.name', [
    'en' => 'Application Name',
    'ar' => 'اسم التطبيق',
]);
```

### `deleteEntry`

[](#deleteentry)

```
$settings->deleteEntry('app.name');
```

### `getAll`

[](#getall)

```
$all = $settings->getAll(); // returns the full settings array
```

---

Dot Notation
------------

[](#dot-notation)

All keys support unlimited nesting via dot notation:

```
@settings('company.address.city', 'Cairo')
@settings('company.address.country', 'Egypt')
```

```
$settings->getValue('company.address.city'); // "Cairo"
$settings->deleteEntry('company.address.city');
```

---

Dashboard
---------

[](#dashboard)

Statica ships with a built-in dashboard for editing settings at runtime, automatically available at:

```
/statica/dashboard

```

The dashboard is registered automatically by the service provider — no route registration needed. It supports inline editing, translatable fields, and drag-and-drop list reordering.

### Customizing the Dashboard Views

[](#customizing-the-dashboard-views)

After publishing the views:

```
php artisan vendor:publish --tag=statica-views
```

The views will be placed at `resources/views/vendor/statica/`. Laravel will automatically use your overrides instead of the package defaults.

---

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for recent changes.

---

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

---

Security
--------

[](#security)

If you discover any security related issues, please email the author directly instead of using the issue tracker.

---

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance62

Regular maintenance activity

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/8632736af6d16c89334c21499d28018f8bfd4fe501e9c40c9145f50ea3f10e64?d=identicon)[abdalhalem-alfakhrany](/maintainers/abdalhalem-alfakhrany)

---

Top Contributors

[![abdalhalem-alfakhrany](https://avatars.githubusercontent.com/u/78089032?v=4)](https://github.com/abdalhalem-alfakhrany "abdalhalem-alfakhrany (3 commits)")

### Embed Badge

![Health badge](/badges/abdalhalem-statica/health.svg)

```
[![Health](https://phpackages.com/badges/abdalhalem-statica/health.svg)](https://phpackages.com/packages/abdalhalem-statica)
```

PHPackages © 2026

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