File: definition.md

package info (click to toggle)
php-di 7.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,932 kB
  • sloc: php: 10,572; makefile: 42; xml: 17; sh: 10; pascal: 5
file content (36 lines) | stat: -rw-r--r-- 1,040 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
layout: documentation
current_menu: definition-introduction
---

# Definitions

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

- use [autowiring](autowiring.md)
- use [attributes](attributes.md)
- use [PHP definitions](php-definitions.md)

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](definition-overriding.md)


## Autowiring

See the dedicated documentation about [autowiring](autowiring.md).

## Attributes

See the dedicated documentation about [attributes](attributes.md).

## PHP configuration

See the dedicated documentation about [PHP definitions](php-definitions.md).