PHPackages                             phpolar/property-injector - 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. phpolar/property-injector

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

phpolar/property-injector
=========================

Provides automatic dependency injection for properties.

1.1.2(5mo ago)04951MITPHPPHP &gt;=8.1CI passing

Since Sep 2Pushed 5mo agoCompare

[ Source](https://github.com/phpolar/property-injector)[ Packagist](https://packagist.org/packages/phpolar/property-injector)[ RSS](/packages/phpolar-property-injector/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (7)Used By (1)

 [![](./phpolar.svg)](./phpolar.svg)

Property Injector
=================

[](#property-injector)

Provides automatic dependency injection for properties.
-------------------------------------------------------

[](#provides-automatic-dependency-injection-for-properties)

[![Coverage Status](https://camo.githubusercontent.com/8137c10e0afa505b4c9e4b31b96ee2c5faf5eae53b87f0d892f57972f747cff1/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f7068706f6c61722f70726f70657274792d696e6a6563746f722f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/repos/github/phpolar/property-injector/badge.svg?branch=main) [![Latest Stable Version](https://camo.githubusercontent.com/b25c1f9783f67f0dbcba3cbcb4653d01a0a4a46dbfb1ed337bfd1eee9942b74b/687474703a2f2f706f7365722e707567782e6f72672f7068706f6c61722f70726f70657274792d696e6a6563746f722f76)](https://camo.githubusercontent.com/b25c1f9783f67f0dbcba3cbcb4653d01a0a4a46dbfb1ed337bfd1eee9942b74b/687474703a2f2f706f7365722e707567782e6f72672f7068706f6c61722f70726f70657274792d696e6a6563746f722f76) [![Total Downloads](https://camo.githubusercontent.com/4ec2fa8dd6154f1e708f12fc16265dc19828361820a4074499235581dabeb148/687474703a2f2f706f7365722e707567782e6f72672f7068706f6c61722f70726f70657274792d696e6a6563746f722f646f776e6c6f616473)](https://camo.githubusercontent.com/4ec2fa8dd6154f1e708f12fc16265dc19828361820a4074499235581dabeb148/687474703a2f2f706f7365722e707567782e6f72672f7068706f6c61722f70726f70657274792d696e6a6563746f722f646f776e6c6f616473) [![Latest Unstable Version](https://camo.githubusercontent.com/1dfaed00b88ad6fa7902543a043f8da2bdeba87824788ebab1a4ea51de750ce2/687474703a2f2f706f7365722e707567782e6f72672f7068706f6c61722f70726f70657274792d696e6a6563746f722f762f756e737461626c65)](https://camo.githubusercontent.com/1dfaed00b88ad6fa7902543a043f8da2bdeba87824788ebab1a4ea51de750ce2/687474703a2f2f706f7365722e707567782e6f72672f7068706f6c61722f70726f70657274792d696e6a6563746f722f762f756e737461626c65) [![License](https://camo.githubusercontent.com/c50108136e4ac26e1998c8cd57dc87f10e0a9a13d8222c1ca56d43887214d2a0/687474703a2f2f706f7365722e707567782e6f72672f7068706f6c61722f70726f70657274792d696e6a6563746f722f6c6963656e7365)](https://camo.githubusercontent.com/c50108136e4ac26e1998c8cd57dc87f10e0a9a13d8222c1ca56d43887214d2a0/687474703a2f2f706f7365722e707567782e6f72672f7068706f6c61722f70726f70657274792d696e6a6563746f722f6c6963656e7365) [![PHP Version Require](https://camo.githubusercontent.com/96761d7a7185d3c217a26618d4053a8cfa6ee2cbf92581e6eeff91fe80947150/687474703a2f2f706f7365722e707567782e6f72672f7068706f6c61722f70726f70657274792d696e6a6563746f722f726571756972652f706870)](https://camo.githubusercontent.com/96761d7a7185d3c217a26618d4053a8cfa6ee2cbf92581e6eeff91fe80947150/687474703a2f2f706f7365722e707567782e6f72672f7068706f6c61722f70726f70657274792d696e6a6563746f722f726571756972652f706870) [![Weekly Check](https://github.com/phpolar/property-injector/actions/workflows/weekly.yml/badge.svg)](https://github.com/phpolar/property-injector/actions/workflows/weekly.yml)

Quick Start
-----------

[](#quick-start)

```
class Example1
{
    /**
     * Will set this property with the
     * value in the DI container
     * that is registered with 'DEPENDENCY_ID'
     */
    #[Inject("DEPENDENCY_ID")]
    public string $property;
}

class Example2
{
    /**
     * Will set this property with the
     * value in the DI container
     * that is registered with the claass name
     * in the type hint
     */
    #[Inject]
    public SomeDependency $property;
}

class Example3
{
    /**
     * Will ignore protected properties.
     */
    #[Inject]
    protected SomeDependency $property;

    /**
     * Will ignore private properties.
     */
    #[Inject]
    private SomeDependency $property;
}

$injectee = new Example1();
(new PropertyInjector($psr11Container))->inject($injectee);

$injectee->property === $psr11Container->get("DEPENDENCY_ID"); // true
```

[API Documentation](https://phpolar.github.io/property-injector/)
-----------------------------------------------------------------

[](#api-documentation)

Thresholds
----------

[](#thresholds)

Source Code Size \*Memory Usage2300 B5.5 kB- Note: Does not include comments.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance71

Regular maintenance activity

Popularity15

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 51.2% 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 ~412 days

Total

3

Last Release

165d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6f34e51c09f71ccba1670d080b700e489cc2cffd43f4bed7684af4dff0195732?d=identicon)[phpolar](/maintainers/phpolar)

![](https://avatars.githubusercontent.com/u/40972462?v=4)[Eric Fortmeyer](/maintainers/ericfortmeyer)[@ericfortmeyer](https://github.com/ericfortmeyer)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (41 commits)")[![ericfortmeyer](https://avatars.githubusercontent.com/u/40972462?v=4)](https://github.com/ericfortmeyer "ericfortmeyer (39 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phpolar-property-injector/health.svg)

```
[![Health](https://phpackages.com/badges/phpolar-property-injector/health.svg)](https://phpackages.com/packages/phpolar-property-injector)
```

###  Alternatives

[symfony/dependency-injection

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

4.2k431.1M7.5k](/packages/symfony-dependency-injection)[illuminate/contracts

The Illuminate Contracts package.

705122.9M10.1k](/packages/illuminate-contracts)[illuminate/container

The Illuminate Container package.

31178.1M2.0k](/packages/illuminate-container)[ecotone/ecotone

Supporting you in building DDD, CQRS, Event Sourcing applications with ease.

558549.8k17](/packages/ecotone-ecotone)[civicrm/civicrm-core

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

728272.9k20](/packages/civicrm-civicrm-core)[internal/dload

Downloads binaries.

98142.7k10](/packages/internal-dload)

PHPackages © 2026

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