Skip to content

Commit d938523

Browse files
committed
updating README.md - add example using alias
1 parent a231f17 commit d938523

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ interface StorageInterface
3131
public function store(mixed $data): bool;
3232
}
3333

34+
#[Provides('storage')]
3435
#[Provides(StorageInterface::class)]
3536
#[Singleton]
3637
class Storage implements StorageInterface
@@ -63,6 +64,7 @@ $container->addAlias(StorageInterface::class, Storage::class);
6364

6465
//Use this instead:
6566
//$container->loadDefinitionsFromDirectory($directory, $namespace); //Loads annotations from classes declared in a PSR4 directory
67+
//var_dump($container->get('storage')->store($data));
6668

6769
var_dump($container->get(MyController::class)->save()); //bool(true)
6870
```

0 commit comments

Comments
 (0)