PHPackages                             jmartin82/dic-doc - 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. jmartin82/dic-doc

ActiveLibrary

jmartin82/dic-doc
=================

Magic type hinting for dependency injection container results

771PHP

Since Apr 16Pushed 10y ago2 watchersCompare

[ Source](https://github.com/jmartin82/DicDoc)[ Packagist](https://packagist.org/packages/jmartin82/dic-doc)[ RSS](/packages/jmartin82-dic-doc/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

DIC - DOC
=========

[](#dic---doc)

Dependency Injection Container Documentator

[![Build Status](https://camo.githubusercontent.com/d1dd41497be4cbd14520dcb4896e643b53b0acdaddc504e37bd0574868f67055/68747470733a2f2f7472617669732d63692e6f72672f6a6d617274696e38322f446963446f632e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jmartin82/DicDoc) [![Coverage Status](https://camo.githubusercontent.com/a1b2c4fef407d455bd627746dc74ccc29eeea4218b208d98c5814049305989e8/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6a6d617274696e38322f446963446f632f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/jmartin82/DicDoc?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/df81b6ca5abaf922e00d27e9d021f4787bf800330e47c4d3f7010294752d3b8d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a6d617274696e38322f446963446f632f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/jmartin82/DicDoc/?branch=master)

The problem
-----------

[](#the-problem)

Since I've been using Dependency Injection Containers in my projects, the IDEs no longer understands what’s going on in some places in my code.

This problems affect the code hints, autocompletion and refactoring tools when dealing with classes. Then my IDE becomes useless.

The solution
------------

[](#the-solution)

You can define class of the variable returned by DIC 'manually':

```
/** @var YourClassType $mailer */
$mailer = $container['mailer'];

```

Use two asterisks and write the data type before the name of the variable. You can write the data type without the name of the variable (but not the name without the data type).

In the major part of the IDEs this comment solves your problems. But...

The lazy solution
-----------------

[](#the-lazy-solution)

If you are a lazy person like me, you can use de DIC.

To document any variable from your code, you should enclose the variable with `dd` function, execute the code and black magic is going to happen (ok, not too magic, but it works)!

**Before:**

```
$mailer = dd($container['mailer']);

```

**Start:**

```
/** @var YourClassType $mailer */
$mailer = $container['mailer'];

```

Installation / Usage
--------------------

[](#installation--usage)

1. Download and install Composer by following the [official instructions](https://getcomposer.org/download/).
2. Create a composer.json defining the dependencies.

    ```
    {
        "require-dev": {
            "jmartin82/DicDoc": "dev-master"
        }
    }
    ```
3. Run Composer: `php composer.phar install`

### Important

[](#important)

- The code have to run to be replaced
- Never use the dd function in production code
- Always review the changes
- Remember refresh the file if the IDE doesn't do it automatically.

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.8% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/22e5dd719293213fe96397f825e979e599c7048c30b5ec7a4adbc122f3dc4f98?d=identicon)[jmartin82](/maintainers/jmartin82)

---

Top Contributors

[![jmartin82](https://avatars.githubusercontent.com/u/152270?v=4)](https://github.com/jmartin82 "jmartin82 (9 commits)")[![jmartinmad](https://avatars.githubusercontent.com/u/17850794?v=4)](https://github.com/jmartinmad "jmartinmad (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

### Embed Badge

![Health badge](/badges/jmartin82-dic-doc/health.svg)

```
[![Health](https://phpackages.com/badges/jmartin82-dic-doc/health.svg)](https://phpackages.com/packages/jmartin82-dic-doc)
```

PHPackages © 2026

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