Skip to content

Latest commit

 

History

History
36 lines (22 loc) · 1.02 KB

definition.md

File metadata and controls

36 lines (22 loc) · 1.02 KB
layout current_menu
documentation
definition-introduction

Definitions

To let PHP-DI know what to inject and where, you have several options:

You can also use several or all these options at the same time if you want to.

If you combine several sources, there are priorities that apply. From the highest priority to the least:

  • Explicit definition on the container (i.e. defined with $container->set())
  • PHP file definitions (if you add several configuration files, then the last one can override entries from the previous ones)
  • PHP attributes
  • Autowiring

Read more in the Definition overriding documentation

Autowiring

See the dedicated documentation about autowiring.

Attributes

See the dedicated documentation about attributes.

PHP configuration

See the dedicated documentation about PHP definitions.