PHPackages                             hartmann/resolve-strategy-interface - 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. hartmann/resolve-strategy-interface

ActiveLibrary

hartmann/resolve-strategy-interface
===================================

resolve-strategies allow you to resolve dependencies through a user-defined process

1.1.0(7y ago)0431MITPHPPHP &gt;=7.1

Since Apr 23Pushed 7y agoCompare

[ Source](https://github.com/mark-hartmann/resolve-strategy-interface)[ Packagist](https://packagist.org/packages/hartmann/resolve-strategy-interface)[ RSS](/packages/hartmann-resolve-strategy-interface/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (3)Used By (1)

Resolve Strategy Interface
==========================

[](#resolve-strategy-interface)

A strategy allows you to resolve a dependency through a user-defined process.

For example, if there are multiple request classes (`CreateUserRequest`, `DeletePostRequest`, ...) that inherit from `Request` and are created in the same way
(for example using the `::createFromEnvironment` method), you can do the following with a ResolveStrategy:

```
use \Hartmann\ResolveStrategy\ResolveStrategyInterface

class ResolveRequestStrategy implements ResolveStrategyInterface
{
    /**
     * Checks wether the given class can be resolved by this strategy
     *
     * @param string $class The fully qualified namespace of the class to be resolved
     *
     * @return bool
     */
    public function suitable(string $class): bool
    {
        return method_exists($class, 'createFromEnvironment') && preg_match('/^.+?Request$/') === 1;
    }

    /**
     * A strategy allows you to resolve a dependency through a user-defined process.
     * For example, if a class is instantiated by a static method (e.g. ::createFromEnvironment), this can be resolved by a strategy.
     *
     * @param \Psr\Container\ContainerInterface $container The instance of the PSR-11 container
     * @param string                            $class     The fully qualified namespace of the class to be resolved
     *
     * @return object The instance of the requested class
     */
    public function resolve(\Psr\Container\ContainerInterface $container, string $class)
    {
        return call_user_func([$class, 'createFromEnvironment'], $container->get('environment'));
    }
}
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

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

Total

2

Last Release

2579d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1a2b9cbc9878208f8dfc12eaf51dd52aaced7a57a810c35d0731719bd162e7ca?d=identicon)[mark-hartmann](/maintainers/mark-hartmann)

---

Top Contributors

[![mark-hartmann](https://avatars.githubusercontent.com/u/21173286?v=4)](https://github.com/mark-hartmann "mark-hartmann (3 commits)")

### Embed Badge

![Health badge](/badges/hartmann-resolve-strategy-interface/health.svg)

```
[![Health](https://phpackages.com/badges/hartmann-resolve-strategy-interface/health.svg)](https://phpackages.com/packages/hartmann-resolve-strategy-interface)
```

###  Alternatives

[pimple/pimple

Pimple, a simple Dependency Injection Container

2.7k130.5M1.4k](/packages/pimple-pimple)[neos/flow

Flow Application Framework

862.0M451](/packages/neos-flow)[api-platform/state

API Platform state interfaces

223.4M57](/packages/api-platform-state)[internal/dload

Downloads binaries.

98142.7k10](/packages/internal-dload)[symfony/json-streamer

Provides powerful methods to read/write data structures from/into JSON streams.

14440.0k8](/packages/symfony-json-streamer)[rubix/server

Deploy your Rubix ML models to production with scalable stand-alone inference servers.

632.3k](/packages/rubix-server)

PHPackages © 2026

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