Skip to content

Commit e2dddfe

Browse files
authored
Update README.md
1 parent c8f5fd3 commit e2dddfe

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ You can declare a service by providing a deferred resolver function for it.
141141
The service container will call that function for the first time the service
142142
is requested and remember the result.
143143

144+
This pattern is often called *lazy initialization*.
145+
144146
- `::deferred(string $serviceId, callable $resolver): void` — Provide a deferred resolver for the given service name.
145147

146148
*Note: the callback function parameters are auto-wired the same way as with the `->call()` API.*
@@ -166,7 +168,7 @@ assert($connection === $same_connection); // The same instance
166168
You can also provide a factory function to be used to construct a new service instance
167169
every time it is requested.
168170

169-
It works very similarly to `->resolver()`, but calls the factory function every time.
171+
It works very similarly to `->deferred()`, but calls the factory function every time.
170172

171173
- `::factory(string $serviceId, callable $factory): void` — Bind a service to a factory function to be called every time it is requested.
172174

0 commit comments

Comments
 (0)