PHPackages                             pimcore/static-resolver-bundle - 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. pimcore/static-resolver-bundle

ActivePimcore-bundle

pimcore/static-resolver-bundle
==============================

Pimcore Static Resolver Bundle

v3.5.0(2mo ago)3319.8k↑10.8%5[1 PRs](https://github.com/pimcore/static-resolver-bundle/pulls)2proprietaryPHPPHP ~8.3.0 || ~8.4.0CI passing

Since Aug 11Pushed 1mo ago7 watchersCompare

[ Source](https://github.com/pimcore/static-resolver-bundle)[ Packagist](https://packagist.org/packages/pimcore/static-resolver-bundle)[ RSS](/packages/pimcore-static-resolver-bundle/feed)WikiDiscussions 2026.x Synced 1mo ago

READMEChangelog (10)Dependencies (20)Versions (48)Used By (2)

Static Resolver Bundle
======================

[](#static-resolver-bundle)

What is the Static Resolver Bundle?
-----------------------------------

[](#what-is-the-static-resolver-bundle)

The Static Resolver Bundle is a Pimcore bundle designed to encapsulate static method calls within a service-oriented architecture. It provides a straightforward mechanism to transform static methods into injectable services, promoting a cleaner, more testable, and well-organized codebase.

In many PHP applications, including Pimcore, static methods are commonly used for utility functions and global operations. While convenient, static methods have several drawbacks:

1. **Testing Difficulties**: Static methods are hard to mock in unit tests
2. **Tight Coupling**: Code using static calls is tightly coupled to the implementation
3. **Hidden Dependencies**: Static dependencies aren't explicit in class constructors

The Static Resolver Bundle addresses these issues by wrapping static calls in service classes that can be properly injected and mocked.

Architecture
------------

[](#architecture)

The bundle follows a consistent pattern for each static class it wraps:

1. **Contract Interfaces**: Define the methods that will be available (e.g., `DbResolverContractInterface`)
2. **Contract Implementations**: Implement the interfaces by wrapping static calls (e.g., `DbResolverContract`)
3. **Bundle-specific Interfaces**: Extend the contract interfaces and are marked as internal (e.g., `DbResolverInterface`)
4. **Bundle-specific Implementations**: Extend the contract implementations and implement the bundle-specific interfaces (e.g., `DbResolver`)

This layered approach allows for flexibility and maintainability while keeping the public API clean.

How to Use the Static Resolver Bundle
-------------------------------------

[](#how-to-use-the-static-resolver-bundle)

### Installation

[](#installation)

1. Install via Composer:

    ```
    composer require pimcore/static-resolver-bundle
    ```
2. Enable the bundle in `config/bundles.php`:

    ```
    use Pimcore\Bundle\StaticResolverBundle\PimcoreStaticResolverBundle;
    // ...

    return [
        // ...
        PimcoreStaticResolverBundle::class => ['all' => true],
        // ...
    ];
    ```

### Using Resolver Services

[](#using-resolver-services)

Instead of using static calls directly in your code, inject the appropriate resolver service and use its methods:

#### Before (with static calls):

[](#before-with-static-calls)

```
use Pimcore\Tool\Authentication;

final class SecurityService implements SecurityServiceInterface
{
    public function getPimcoreUser(): User
    {
        $pimcoreUser = Authentication::authenticateSession();
        if (!$pimcoreUser instanceof User) {
            throw new Exception('No pimcore user found');
        }

        return $pimcoreUser;
    }
}
```

#### After (with resolver service):

[](#after-with-resolver-service)

```
use Pimcore\Bundle\StaticResolverBundle\Contract\Lib\Tools\Authentication\AuthenticationResolverContractInterface;

final class SecurityService implements SecurityServiceInterface
{
     public function __construct(private readonly AuthenticationResolverContractInterface $authenticationResolver
    ) {
    }

    public function getPimcoreUser(): User
    {
        $pimcoreUser = $this->authenticationResolver->authenticateSession();
        if (!$pimcoreUser instanceof User) {
            throw new Exception('No pimcore user found');
        }

        return $pimcoreUser;
    }
}
```

### Available Resolver Services

[](#available-resolver-services)

The bundle provides resolver services for various Pimcore components:

1. **Database Operations**:

    - `Pimcore\Bundle\StaticResolverBundle\Contract\Db\DbResolverContractInterface`
2. **Model Operations**:

    - Various resolvers for DataObject, Asset, Document, etc.
3. **Library Tools**:

    - Authentication, Console, Email, etc.

### Benefits of Using Resolver Services

[](#benefits-of-using-resolver-services)

1. **Improved Testability**: Services can be easily mocked in unit tests
2. **Explicit Dependencies**: Dependencies are clearly visible in constructor parameters
3. **Loose Coupling**: Code depends on interfaces rather than concrete implementations
4. **Consistent API**: The resolver services provide a consistent API for static functionality

Example Use Cases
-----------------

[](#example-use-cases)

### Database Operations

[](#database-operations)

Instead of using `Pimcore\Db` static methods:

```
use Pimcore\Db;

$connection = Db::getConnection();
$data = $connection->fetchAllAssociative('SELECT * FROM users');
```

Use the DbResolver service:

```
use Pimcore\Bundle\StaticResolverBundle\Contract\Db\DbResolverContractInterface;

class UserRepository
{
    public function __construct(private readonly DbResolverContractInterface $dbResolver)
    {
    }

    public function getAllUsers(): array
    {
        $connection = $this->dbResolver->getConnection();
        return $connection->fetchAllAssociative('SELECT * FROM users');
    }
}
```

### Authentication

[](#authentication)

Instead of using `Pimcore\Tool\Authentication` static methods:

```
use Pimcore\Tool\Authentication;

$user = Authentication::authenticateSession();
```

Use the AuthenticationResolver service:

```
use Pimcore\Bundle\StaticResolverBundle\Contract\Lib\Tools\Authentication\AuthenticationResolverContractInterface;

class AuthService
{
    public function __construct(private readonly AuthenticationResolverContractInterface $authenticationResolver)
    {
    }

    public function getCurrentUser()
    {
        return $this->authenticationResolver->authenticateSession();
    }
}
```

Internal Use Examples
---------------------

[](#internal-use-examples)

For internal Pimcore use, you can use the Bundle-specific Interfaces (marked as `@internal`). These interfaces extend the Contract Interfaces and may provide additional functionality specific to Pimcore's internal needs.

### Database Operations (Internal Use)

[](#database-operations-internal-use)

```
use Pimcore\Bundle\StaticResolverBundle\Db\DbResolverInterface;

/**
 * @internal This class is for internal Pimcore use only
 */
class InternalPimcoreService
{
    public function __construct(private readonly DbResolverInterface $dbResolver)
    {
    }

    public function executeInternalQuery(): array
    {
        $connection = $this->dbResolver->getConnection();
        return $connection->fetchAllAssociative('SELECT * FROM internal_table');
    }
}
```

### Authentication (Internal Use)

[](#authentication-internal-use)

```
use Pimcore\Bundle\StaticResolverBundle\Lib\Tools\Authentication\AuthenticationResolverInterface;

/**
 * @internal This class is for internal Pimcore use only
 */
class InternalAuthService
{
    public function __construct(private readonly AuthenticationResolverInterface $authenticationResolver)
    {
    }

    public function validateInternalUser()
    {
        return $this->authenticationResolver->authenticateSession();
    }
}
```

Important Notes
---------------

[](#important-notes)

- All Contract Interfaces in this bundle are designed for third-party developers to use
- Bundle-specific Interfaces (marked as `@internal`) are intended for internal Pimcore use only
- The bundle provides a transition path from static methods to a more service-oriented architecture

Documentation Overview
----------------------

[](#documentation-overview)

- [Installation](doc/01_Installation.md)
- [Resolver Service Usage](doc/02_Resolver_Service_Usage.md)
- [Event Proxy Service Usage (deprecated)](doc/03_Event_Proxy_Service_Usage.md)
- [Interceptor Proxy Service Usage (deprecated)](doc/03_Interceptor_Proxy_Service_Usage.md)
- [Proxy Service Usage (deprecated)](doc/04_Proxy_Service_Usage.md)
- [Upgrade Notes](doc/02_Upgrade_Notes/README.md)

###  Health Score

61

—

FairBetter than 99% of packages

Maintenance88

Actively maintained with recent releases

Popularity42

Moderate usage in the ecosystem

Community30

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~31 days

Recently: every ~6 days

Total

32

Last Release

53d ago

Major Versions

v1.4.2 → v2.0.02024-11-28

2.0.x-dev → v3.0.0-RC12025-04-22

v3.5.0 → 2026.x-dev2026-03-26

PHP version history (4 changes)v1.0.0-RC1PHP ~8.1.0 || ~8.2.0

v1.4.1PHP ~8.1.0 || ~8.2.0 || ~8.3.0

v3.0.0-RC1PHP ~8.3.0 || ~8.4.0

2026.x-devPHP ~8.4.0 || ~8.5.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/142037?v=4)[Bernhard Rusch](/maintainers/brusch)[@brusch](https://github.com/brusch)

![](https://www.gravatar.com/avatar/fb2f85a3d50811c4d9e10844b4677b8c407adde4173226450dd0bf386914a125?d=identicon)[fashxp](/maintainers/fashxp)

![](https://www.gravatar.com/avatar/1a4f3f1757235f1aa825553d8cc9a0f8fe4def6f406eb37e83220669d2eda268?d=identicon)[herbertroth](/maintainers/herbertroth)

---

Top Contributors

[![herbertroth](https://avatars.githubusercontent.com/u/126679157?v=4)](https://github.com/herbertroth "herbertroth (149 commits)")[![lukmzig](https://avatars.githubusercontent.com/u/30526586?v=4)](https://github.com/lukmzig "lukmzig (44 commits)")[![mcop1](https://avatars.githubusercontent.com/u/89011527?v=4)](https://github.com/mcop1 "mcop1 (40 commits)")[![martineiber](https://avatars.githubusercontent.com/u/11687066?v=4)](https://github.com/martineiber "martineiber (33 commits)")[![mattamon](https://avatars.githubusercontent.com/u/38959016?v=4)](https://github.com/mattamon "mattamon (30 commits)")[![fashxp](https://avatars.githubusercontent.com/u/8792145?v=4)](https://github.com/fashxp "fashxp (7 commits)")[![Corepex](https://avatars.githubusercontent.com/u/16717695?v=4)](https://github.com/Corepex "Corepex (6 commits)")[![alexz707](https://avatars.githubusercontent.com/u/562324?v=4)](https://github.com/alexz707 "alexz707 (6 commits)")[![berfinyuksel](https://avatars.githubusercontent.com/u/99557970?v=4)](https://github.com/berfinyuksel "berfinyuksel (4 commits)")[![samyemad](https://avatars.githubusercontent.com/u/12701127?v=4)](https://github.com/samyemad "samyemad (2 commits)")[![jcPimcore](https://avatars.githubusercontent.com/u/259032526?v=4)](https://github.com/jcPimcore "jcPimcore (2 commits)")[![kingjia90](https://avatars.githubusercontent.com/u/6014195?v=4)](https://github.com/kingjia90 "kingjia90 (2 commits)")[![robertSt7](https://avatars.githubusercontent.com/u/104770750?v=4)](https://github.com/robertSt7 "robertSt7 (2 commits)")[![dvesh3](https://avatars.githubusercontent.com/u/5137917?v=4)](https://github.com/dvesh3 "dvesh3 (1 commits)")[![mcassier31](https://avatars.githubusercontent.com/u/127942915?v=4)](https://github.com/mcassier31 "mcassier31 (1 commits)")[![bluvulture](https://avatars.githubusercontent.com/u/7668379?v=4)](https://github.com/bluvulture "bluvulture (1 commits)")[![pimcore-deployments](https://avatars.githubusercontent.com/u/71881008?v=4)](https://github.com/pimcore-deployments "pimcore-deployments (1 commits)")[![blankse](https://avatars.githubusercontent.com/u/998558?v=4)](https://github.com/blankse "blankse (1 commits)")[![jdreesen](https://avatars.githubusercontent.com/u/424602?v=4)](https://github.com/jdreesen "jdreesen (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/pimcore-static-resolver-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/pimcore-static-resolver-bundle/health.svg)](https://phpackages.com/packages/pimcore-static-resolver-bundle)
```

###  Alternatives

[sylius/sylius

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

8.4k5.6M651](/packages/sylius-sylius)[symfony/proxy-manager-bridge

Provides integration for ProxyManager with various Symfony components

763106.0M264](/packages/symfony-proxy-manager-bridge)[doctrine/mongodb-odm

PHP Doctrine MongoDB Object Document Mapper (ODM) provides transparent persistence for PHP objects to MongoDB.

1.1k23.3M302](/packages/doctrine-mongodb-odm)[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[pimcore/admin-ui-classic-bundle

171.1M46](/packages/pimcore-admin-ui-classic-bundle)[pimcore/studio-backend-bundle

Pimcore Studio Backend Bundle

19112.5k3](/packages/pimcore-studio-backend-bundle)

PHPackages © 2026

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