Skip to content

Commit

Permalink
docs improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikbosch committed May 22, 2024
1 parent c5c7176 commit 0562fab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 7 additions & 5 deletions docs/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ It is basically the same as if you would write the following:
$di->params['Example']['foo'] = $di->lazyGetCall('config', 'get', 'foo');
```

## Overwriting injection attributes
## Overwriting attribute injection

When you define both an annotation and an injection via code, the injection via code has precedence over the annotation.

Expand All @@ -185,11 +185,13 @@ $di->params['Example']['foo'] = $di->lazyGetCall('config', 'get', 'alpha');
## Modify the Container using attributes

Modifying the container with attributes requires building the container with the
[`AnnotatedResolverFactory`](config.md#containerbuilder-and-annotations). When done so, the builder will scan the
passed directories for classes and annotations. Every attribute that implements the `DefineInterface` can modify the
container.
[`ContainerConfigClassScanner`](config.md#scan-for-classes-and-annotations). When done so, the builder will scan the
passed directories for classes and annotations. Every attribute that implements the `AttributeConfigInterface` can modify the
container. See the [`ContainerConfigClassScanner` documentation](config.md#scan-for-classes-and-annotations)) how to
modify the container for external attributes.

Suppose you create a `#[Route]` attribute and define it inside a `Controller` class.
In the following example we create our own a `#[Route]` attribute that implements the `AttributeConfigInterface` and
annotate methods with it inside a `Controller` class.

```php
#[\Attribute]
Expand Down
3 changes: 2 additions & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ However, this is a relatively naive way to create objects with the _Container_.

A full-featured container can use [attributes](attributes.md) for injection and container modification. Moreover, for
maximum performance, we would have to compile the container, serialize it and save it to a cache layer like the filesystem.
Subsequent processes unserialize the
Subsequent processes would only have to unserialize to have a compiled container. The `ContainerConfigClassScanner`
scans for classes and annotations inside your project.

```php
use Aura\Di\ContainerBuilder;
Expand Down

0 comments on commit 0562fab

Please sign in to comment.