Skip to content

Commit

Permalink
improve changelog and getting started
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikbosch committed Aug 13, 2024
1 parent 0502e03 commit 1acdb9b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
## Unreleased

- (ADD) $container->lazyLazy() to create a callable from a LazyInterface that is directly invokable.
- (ADD) `#[AttributeConfigFor]` attribute to indicate scanner which attribute is configured by the annotated class.
- (ADD) `#[CompileNamespace]` attribute to indicate scanner which namespace should have compiled blueprints.
- (ADD) `bin/auradi` executable with scan command.
- (CHG) Fix `lazyGet` not resolving the same service.
- (CHG) Fix collection of attributes for class constants.
- (CHG) `#[Service]`, `#[Instance]` and `#[Value]` must have `Attribute::TARGET_PROPERTY` to allow constructor promotion.

## 5.0.0-alpha.1

- (ADD) Inject via attributes
- (ADD) Inject via `#[Service]`, `#[Instance]` and `#[Value]` attributes.
- (ADD) Configure the container via attributes using the AttributeConfigInterface
- (ADD) Directories scanner for classes and annotations
- (ADD) Dependency requirement of composer/class-map-generator when using the scanner
Expand Down
12 changes: 5 additions & 7 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,14 @@ 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 would only have to unserialize to have a compiled container.
Subsequent processes would only have to unserialize to have a compiled container.

The `ClassScanner` scans for classes and annotations inside your project. This does require,
however, to add a package to your dependencies.
The `ClassScannerConfig` scans for classes and annotations inside your project. This does require,
however, to add a package to your dependencies and run the `scan` command in the `auradi` executable.

```sh
composer require composer/class-map-generator
vendor/bin/auradi scan --force
```

Creating a fully-featured container could look as follows:
Expand All @@ -84,10 +85,7 @@ $serializedContainerFile = '/var/compiled.ser';
$config_classes = [
new \MyApp\Config1,
new \MyApp\Config2,
ClassScannerConfig::newScanner(
[$rootDir . '/app/src'], // these directories should be scanned for classes and annotations
['MyApp\\'], // classes inside these namespaces should be compiled
)
ClassScannerConfig::newScanner(__DIR__ . '/../../aura.di.scan.json') // reference the correct path here
];

if (file_exists($serializedContainerFile)) {
Expand Down

0 comments on commit 1acdb9b

Please sign in to comment.