@@ -13,8 +13,8 @@ Making simple asynchronous requests:
1313
1414``` php
1515use function fetch;
16- use function async;
17- use function await;
16+ use function Matrix\Support\ async;
17+ use function Matrix\Support\ await;
1818
1919// Create an async function
2020$fetchUsers = async(function() {
@@ -34,9 +34,9 @@ Making multiple requests in parallel:
3434
3535``` php
3636use function fetch;
37- use function async;
38- use function await;
39- use function all;
37+ use function Matrix\Support\ async;
38+ use function Matrix\Support\ await;
39+ use function Matrix\Support\ all;
4040
4141// Create async functions for different endpoints
4242$fetchUsers = async(function() {
@@ -74,8 +74,8 @@ Making sequential requests where each depends on the result of the previous one:
7474
7575``` php
7676use function fetch;
77- use function async;
78- use function await;
77+ use function Matrix\Support\ async;
78+ use function Matrix\Support\ await;
7979
8080await(async(function() {
8181 // First, get a list of users
@@ -119,9 +119,9 @@ Using `race()` to get the result from whichever request finishes first:
119119
120120``` php
121121use function fetch;
122- use function async;
123- use function await;
124- use function race;
122+ use function Matrix\Support\ async;
123+ use function Matrix\Support\ await;
124+ use function Matrix\Support\ race;
125125
126126// Create promises for multiple mirror servers
127127$promises = [
@@ -151,9 +151,9 @@ Using `any()` to get the first successful result, ignoring failures:
151151
152152``` php
153153use function fetch;
154- use function async;
155- use function await;
156- use function any;
154+ use function Matrix\Support\ async;
155+ use function Matrix\Support\ await;
156+ use function Matrix\Support\ any;
157157
158158// Create promises for redundant endpoints
159159$promises = [
@@ -178,9 +178,9 @@ Process many items concurrently, but limit how many run at once:
178178
179179``` php
180180use function fetch;
181- use function async;
182- use function await;
183- use function map;
181+ use function Matrix\Support\ async;
182+ use function Matrix\Support\ await;
183+ use function Matrix\Support\ map;
184184
185185// List of user IDs to process
186186$userIds = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
@@ -212,9 +212,9 @@ Process items in batches rather than individually:
212212
213213``` php
214214use function fetch;
215- use function async;
216- use function await;
217- use function batch;
215+ use function Matrix\Support\ async;
216+ use function Matrix\Support\ await;
217+ use function Matrix\Support\ batch;
218218
219219// List of item IDs to process
220220$itemIds = range(1, 100);
@@ -258,9 +258,9 @@ Adding timeouts to async operations:
258258
259259``` php
260260use function fetch;
261- use function async;
262- use function await;
263- use function timeout;
261+ use function Matrix\Support\ async;
262+ use function Matrix\Support\ await;
263+ use function Matrix\Support\ timeout;
264264
265265try {
266266 // Add a 5-second timeout to a potentially slow request
@@ -283,10 +283,10 @@ Implementing retry logic with async requests:
283283
284284``` php
285285use function fetch;
286- use function async;
287- use function await;
288- use function retry;
289- use function delay;
286+ use function Matrix\Support\ async;
287+ use function Matrix\Support\ await;
288+ use function Matrix\Support\ retry;
289+ use function Matrix\Support\ delay;
290290
291291// Define a function that might fail
292292$fetchData = function() {
@@ -331,9 +331,9 @@ Implementing a rate-limited API client:
331331
332332``` php
333333use function fetch;
334- use function async;
335- use function await;
336- use function delay;
334+ use function Matrix\Support\ async;
335+ use function Matrix\Support\ await;
336+ use function Matrix\Support\ delay;
337337
338338class RateLimitedClient
339339{
@@ -402,9 +402,9 @@ Handling paginated API results with async requests:
402402
403403``` php
404404use function fetch;
405- use function async;
406- use function await;
407- use function all;
405+ use function Matrix\Support\ async;
406+ use function Matrix\Support\ await;
407+ use function Matrix\Support\ all;
408408
409409await(async(function() {
410410 // Get the first page to determine total pages
@@ -447,9 +447,9 @@ Execute requests with complex dependencies:
447447
448448``` php
449449use function fetch;
450- use function async;
451- use function await;
452- use function all;
450+ use function Matrix\Support\ async;
451+ use function Matrix\Support\ await;
452+ use function Matrix\Support\ all;
453453
454454await(async(function() {
455455 // First level: fetch user and categories in parallel
@@ -506,9 +506,9 @@ Robust error handling for async requests:
506506
507507``` php
508508use function fetch;
509- use function async;
510- use function await;
511- use function all;
509+ use function Matrix\Support\ async;
510+ use function Matrix\Support\ await;
511+ use function Matrix\Support\ all;
512512
513513await(async(function() {
514514 try {
@@ -565,8 +565,8 @@ Using async requests with a caching layer:
565565
566566``` php
567567use function fetch;
568- use function async;
569- use function await;
568+ use function Matrix\Support\ async;
569+ use function Matrix\Support\ await;
570570
571571class AsyncCachedAPI
572572{
0 commit comments