PHPackages                             luccpl/sonata - 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. [Admin Panels](/categories/admin)
4. /
5. luccpl/sonata

ActiveLibrary[Admin Panels](/categories/admin)

luccpl/sonata
=============

v0.2.1(9mo ago)11.0kMITPHP

Since May 27Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/Luc-cpl/sonata)[ Packagist](https://packagist.org/packages/luccpl/sonata)[ RSS](/packages/luccpl-sonata/feed)WikiDiscussions main Synced yesterday

READMEChangelog (3)Dependencies (9)Versions (5)Used By (0)

Sonata for Orkestra
===================

[](#sonata-for-orkestra)

Sonata is the base package for the persistence layer in [Orkestra](https://packagist.org/packages/luccpl/orkestra), providing essential functionalities for authentication, session management, and optionally, database interactions through Doctrine ORM.

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

[](#installation)

To install Sonata, use Composer:

```
composer require luccpl/sonata
```

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

[](#configuration)

### Session Management

[](#session-management)

Sonata provides a session interface that currently supports PHP's default session handling. To use it, register the `Sonata\Sessions\SessionsProvider` in your providers list.

### Authentication Configuration

[](#authentication-configuration)

To configure authentication guards, add the `sonata.auth_guards` configuration. This configuration maps guard keys to their respective drivers and repositories:

```
$app->config()->set('sonata.auth_guards', [
    'guard_key' => [
        'driver' => 'session',  // the driver to use for authentication
        'repository' => YourRepository::class,  // An implementation of Sonata\Repositories\Interfaces\Partials\IdentifiableRepositoryInterface
    ],
]);
```

Set the default authentication guard using the `sonata.default_guard` configuration:

```
['sonata.default_guard', 'guard_key'];
```

#### Custom Session Interface

[](#custom-session-interface)

Optionally, you can change the session interface by setting the `sonata.session` configuration:

```
['sonata.session', YourCustomSessionInterface::class];
```

### Added Middleware

[](#added-middleware)

With the session provider registered, you gain access to the `auth` middleware, which can be used to protect routes with the existing guards:

```
return function (RouterInterface $router): void {
    $router->get('/protected', function ($request, $response) {
        return ['message' => 'This is a protected route'];
    })->middleware('auth');
};
```

optionally you can specify a guard key to use a specific guard:

```
return function (RouterInterface $router): void {
    $router->get('/protected', function ($request, $response) {
        return ['message' => 'This is a protected route'];
    })->middleware('auth', ['guard' => 'web']);
};
```

Optional: Doctrine ORM Integration
----------------------------------

[](#optional-doctrine-orm-integration)

If you wish to use Doctrine ORM for database interactions, install the necessary Doctrine packages:

```
composer require doctrine/orm doctrine/dbal doctrine/migrations symfony/cache
```

Then add the `Sonata\Doctrine\DoctrineProvider` to the Orkestra providers list.

#### Default Configuration

[](#default-configuration)

By default, Doctrine is configured to use SQLite. You can configure it to use other databases supported by Doctrine by setting the `doctrine.connection` configuration in Orkestra following the [Doctrine configuration format](https://www.doctrine-project.org/projects/doctrine-dbal/en/4.0/reference/configuration.html).

```
[
	'doctrine.connection' => [
		'dbname' => 'mydb',
		'user' => 'user',
		'password' => 'secret',
		'host' => 'localhost',
		'driver' => 'pdo_mysql',
	],
];
```

#### Entities and Migrations

[](#entities-and-migrations)

You can specify the directories for your entities and migration classes using the `doctrine.entities` and `doctrine.migrations` configurations:

```
[
	'doctrine.entities' => [
		'App\Entities' => '/path/to/entities'
	],
	'doctrine.migrations' => [
		'/path/to/migrations'
	],
];
```

By default, Sonata will use the `App\Entities` namespace for entities and the `App\Migrations` namespace for migrations in `./migrations` directory.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance57

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

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.

###  Release Activity

Cadence

Every ~82 days

Total

3

Last Release

287d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20001157?v=4)[Lucas Carvalho](/maintainers/Luc-cpl)[@Luc-cpl](https://github.com/Luc-cpl)

---

Top Contributors

[![Luc-cpl](https://avatars.githubusercontent.com/u/20001157?v=4)](https://github.com/Luc-cpl "Luc-cpl (59 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/luccpl-sonata/health.svg)

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

###  Alternatives

[sonata-project/admin-bundle

The missing Symfony Admin Generator

2.2k19.5M315](/packages/sonata-project-admin-bundle)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M736](/packages/sylius-sylius)[phpro/grumphp

A composer plugin that enables source code quality checks.

4.3k16.7M1.0k](/packages/phpro-grumphp)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M203](/packages/sulu-sulu)[api-platform/doctrine-common

Common files used by api-platform/doctrine-orm and api-platform/doctrine-odm

274.4M48](/packages/api-platform-doctrine-common)[oro/platform

Business Application Platform (BAP)

645143.5k115](/packages/oro-platform)

PHPackages © 2026

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