PHPackages                             angelobono/php-di-service-attribute - 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. angelobono/php-di-service-attribute

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

angelobono/php-di-service-attribute
===================================

A PHP service attribute that automatically configures factories for (psr) di containers.

1.0.6(1y ago)1105↓91.7%MITPHP

Since Mar 30Pushed 1y ago1 watchersCompare

[ Source](https://github.com/angelobono/php-di-service-attribute)[ Packagist](https://packagist.org/packages/angelobono/php-di-service-attribute)[ RSS](/packages/angelobono-php-di-service-attribute/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (5)Versions (4)Used By (0)

A PHP service attribute that automatically configures factories in a DI container
=================================================================================

[](#a-php-service-attribute-that-automatically-configures-factories-in-a-di-container)

The factories based on constructor reflection

Install
-------

[](#install)

```
composer require angelobono/php-di-service-attribute
```

Usage
-----

[](#usage)

If you have a class you can add the `#[Service]` attribute to it:

```
#[Service]
class TestService1
{
  public function __construct(TestService2 $service2) {
    // ...
  }
}

#[Service]
class TestService2
{
}
```

Then you can use a Container to automatically get an instance of the service:

```
$container = new Container();
Service::setContainer($container);
$serviceInstance = $container->get(TestService1::class);
$serviceInstance instanceof TestService1 === true;
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance47

Moderate activity, may be stable

Popularity11

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

Total

3

Last Release

401d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b10e9cfced6aeed2b2312c2bec7a1be64edae9e06f7b4f6ded834ff7fb292fd?d=identicon)[angelobono](/maintainers/angelobono)

---

Top Contributors

[![angelobono](https://avatars.githubusercontent.com/u/8094731?v=4)](https://github.com/angelobono "angelobono (12 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/angelobono-php-di-service-attribute/health.svg)

```
[![Health](https://phpackages.com/badges/angelobono-php-di-service-attribute/health.svg)](https://phpackages.com/packages/angelobono-php-di-service-attribute)
```

###  Alternatives

[symfony/dependency-injection

Allows you to standardize and centralize the way objects are constructed in your application

4.2k455.6M9.5k](/packages/symfony-dependency-injection)[illuminate/contracts

The Illuminate Contracts package.

706130.3M13.2k](/packages/illuminate-contracts)[illuminate/container

The Illuminate Container package.

31182.0M2.4k](/packages/illuminate-container)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

564576.7k49](/packages/ecotone-ecotone)[symfony/type-info

Extracts PHP types information.

20069.8M269](/packages/symfony-type-info)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k41](/packages/civicrm-civicrm-core)

PHPackages © 2026

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