Skip to content

Commit b0e3258

Browse files
committed
fix: Update function imports to use Matrix\Support namespace across documentation
1 parent 7a4af28 commit b0e3258

17 files changed

+103
-103
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ composer require jerome/fetch-php
6767
### JavaScript-style API (Promise Chaining)
6868

6969
```php
70-
use function async;
70+
use function Matrix\Support\async;
7171

7272
// JavaScript-like promise chaining in PHP
7373
async(fn() => fetch('https://api.example.com/users'))
@@ -120,8 +120,8 @@ $response = fetch_client()
120120
### Using Async/Await
121121

122122
```php
123-
use function async;
124-
use function await;
123+
use function Matrix\Support\async;
124+
use function Matrix\Support\await;
125125

126126
$response = await(async(fn() => fetch('https://api.example.com/users')));
127127
$users = $response->json();
@@ -132,9 +132,9 @@ echo "Fetched " . count($users) . " users";
132132

133133
```php
134134
// These async functions are provided by the Matrix library dependency
135-
use function async;
136-
use function await;
137-
use function all;
135+
use function Matrix\Support\async;
136+
use function Matrix\Support\await;
137+
use function Matrix\Support\all;
138138

139139
// Execute an async function
140140
await(async(function() {
@@ -159,8 +159,8 @@ await(async(function() {
159159
### Sequential Requests with Async/Await
160160

161161
```php
162-
use function async;
163-
use function await;
162+
use function Matrix\Support\async;
163+
use function Matrix\Support\await;
164164

165165
await(async(function() {
166166
// First request: get auth token
@@ -190,8 +190,8 @@ await(async(function() {
190190
### Error Handling with Async/Await
191191

192192
```php
193-
use function async;
194-
use function await;
193+
use function Matrix\Support\async;
194+
use function Matrix\Support\await;
195195

196196
try {
197197
$data = await(async(function() {
@@ -245,7 +245,7 @@ $promise->then(
245245
### Concurrent Requests with Promise Utilities
246246

247247
```php
248-
use function race;
248+
use function Matrix\Support\race;
249249

250250
// Create promises for redundant endpoints
251251
$promises = [
@@ -263,7 +263,7 @@ echo "Got data from the fastest source";
263263
### Controlled Concurrency with Map
264264

265265
```php
266-
use function map;
266+
use function Matrix\Support\map;
267267

268268
// List of user IDs to fetch
269269
$userIds = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
@@ -285,7 +285,7 @@ foreach ($responses as $index => $response) {
285285
### Batch Processing
286286

287287
```php
288-
use function batch;
288+
use function Matrix\Support\batch;
289289

290290
// Array of items to process
291291
$items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
@@ -314,7 +314,7 @@ $results = await(batch(
314314
### With Retries
315315

316316
```php
317-
use function retry;
317+
use function Matrix\Support\retry;
318318

319319
// Retry a flaky request up to 3 times with exponential backoff
320320
$data = await(retry(

docs/api/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ $promise->then(
115115
### Request Batching and Concurrency
116116

117117
```php
118-
use function async;
119-
use function await;
120-
use function all;
121-
use function map;
118+
use function Matrix\Support\async;
119+
use function Matrix\Support\await;
120+
use function Matrix\Support\all;
121+
use function Matrix\Support\map;
122122

123123
// Execute multiple requests in parallel
124124
$results = await(all([

docs/examples/api-integration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,9 @@ This example combines retries, shared pooling, caching, debug snapshots, and asy
381381
use Fetch\Cache\MemoryCache;
382382
use Fetch\Http\ClientHandler;
383383
use Fetch\Support\FetchProfiler;
384-
use function async;
385-
use function await;
386-
use function map;
384+
use function Matrix\Support\async;
385+
use function Matrix\Support\await;
386+
use function Matrix\Support\map;
387387

388388
$handler = ClientHandler::create()
389389
->baseUri('https://status.internal.example')

docs/examples/async-patterns.md

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Making simple asynchronous requests:
1313

1414
```php
1515
use 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
3636
use 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
7676
use function fetch;
77-
use function async;
78-
use function await;
77+
use function Matrix\Support\async;
78+
use function Matrix\Support\await;
7979

8080
await(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
121121
use 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
153153
use 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
180180
use 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
214214
use 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
260260
use 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

265265
try {
266266
// Add a 5-second timeout to a potentially slow request
@@ -283,10 +283,10 @@ Implementing retry logic with async requests:
283283

284284
```php
285285
use 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
333333
use 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

338338
class RateLimitedClient
339339
{
@@ -402,9 +402,9 @@ Handling paginated API results with async requests:
402402

403403
```php
404404
use 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

409409
await(async(function() {
410410
// Get the first page to determine total pages
@@ -447,9 +447,9 @@ Execute requests with complex dependencies:
447447

448448
```php
449449
use 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

454454
await(async(function() {
455455
// First level: fetch user and categories in parallel
@@ -506,9 +506,9 @@ Robust error handling for async requests:
506506

507507
```php
508508
use 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

513513
await(async(function() {
514514
try {
@@ -565,8 +565,8 @@ Using async requests with a caching layer:
565565

566566
```php
567567
use function fetch;
568-
use function async;
569-
use function await;
568+
use function Matrix\Support\async;
569+
use function Matrix\Support\await;
570570

571571
class AsyncCachedAPI
572572
{

docs/examples/authentication.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,8 +810,8 @@ An API client for applications that need to support multiple users or organizati
810810

811811
```php
812812
use function fetch;
813-
use function async;
814-
use function await;
813+
use function Matrix\Support\async;
814+
use function Matrix\Support\await;
815815

816816
class MultiTenantApiClient
817817
{

docs/examples/error-handling.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,9 @@ Handling errors in asynchronous code:
252252

253253
```php
254254
use function fetch;
255-
use function async;
256-
use function await;
257-
use function all;
255+
use function Matrix\Support\async;
256+
use function Matrix\Support\await;
257+
use function Matrix\Support\all;
258258

259259
await(async(function() {
260260
try {

docs/guide/async-requests.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ To make asynchronous requests, wrap your `fetch()` calls with the `async()` func
3030

3131
```php
3232
// Import the async functions
33-
use function async;
34-
use function await;
35-
use function all;
33+
use function Matrix\Support\async;
34+
use function Matrix\Support\await;
35+
use function Matrix\Support\all;
3636

3737
// Create a promise for an async request
3838
$promise = async(function() {
@@ -166,7 +166,7 @@ $handler->async()
166166
Sometimes you may want whichever request finishes first:
167167

168168
```php
169-
use function race;
169+
use function Matrix\Support\race;
170170

171171
// Create promises for redundant endpoints
172172
$promises = [
@@ -186,7 +186,7 @@ echo "Got data from the fastest source";
186186
To get the first successful result (ignoring failures):
187187

188188
```php
189-
use function any;
189+
use function Matrix\Support\any;
190190

191191
// Create promises for redundant endpoints
192192
$promises = [
@@ -210,7 +210,7 @@ try {
210210
For processing many items with controlled parallelism:
211211

212212
```php
213-
use function map;
213+
use function Matrix\Support\map;
214214

215215
// List of user IDs to fetch
216216
$userIds = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
@@ -234,7 +234,7 @@ foreach ($responses as $index => $response) {
234234
For processing items in batches with controlled concurrency:
235235

236236
```php
237-
use function batch;
237+
use function Matrix\Support\batch;
238238

239239
// Array of items to process
240240
$items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
@@ -304,7 +304,7 @@ await(async(function() {
304304
You can combine async operations with retry logic for more resilient requests:
305305

306306
```php
307-
use function retry;
307+
use function Matrix\Support\retry;
308308

309309
// Retry a flaky request up to 3 times with exponential backoff
310310
$data = await(retry(
@@ -326,7 +326,7 @@ $data = await(retry(
326326
You can set a timeout when waiting for a promise:
327327

328328
```php
329-
use function timeout;
329+
use function Matrix\Support\timeout;
330330

331331
try {
332332
// Add a 5-second timeout to a request

docs/guide/authentication.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ $response = $client->get('/protected-resource');
224224
For scenarios where you need to perform authentication in an asynchronous context:
225225

226226
```php
227-
use function async;
228-
use function await;
227+
use function Matrix\Support\async;
228+
use function Matrix\Support\await;
229229

230230
await(async(function() {
231231
// First, get an auth token

0 commit comments

Comments
 (0)