+6
README.md
+6
README.md
···
980
980
```bash
981
981
# Generate OAuth private key
982
982
php artisan atp-client:generate-key
983
+
984
+
# Create a domain client extension
985
+
php artisan make:atp-client AnalyticsClient
986
+
987
+
# Create a request client extension for an existing domain
988
+
php artisan make:atp-request MetricsClient --domain=bsky
983
989
```
984
990
985
991
## Requirements
+27
docs/extensions.md
+27
docs/extensions.md
···
23
23
| Domain Client | `$client->myDomain` | Group related functionality under a namespace |
24
24
| Request Client | `$client->bsky->myFeature` | Add methods to an existing domain |
25
25
26
+
### Generator Commands
27
+
28
+
Quickly scaffold extension classes using artisan commands:
29
+
30
+
```bash
31
+
# Create a domain client extension
32
+
php artisan make:atp-client AnalyticsClient
33
+
34
+
# Create a public domain client extension
35
+
php artisan make:atp-client DiscoverClient --public
36
+
37
+
# Create a request client extension for an existing domain
38
+
php artisan make:atp-request MetricsClient --domain=bsky
39
+
40
+
# Create a public request client extension
41
+
php artisan make:atp-request TrendingClient --domain=bsky --public
42
+
```
43
+
44
+
The generated files are placed in `app/Services/Clients/` (domain clients) and `app/Services/Clients/Requests/` (request clients). You can customize these paths in `config/client.php`:
45
+
46
+
```php
47
+
'generators' => [
48
+
'client_path' => 'app/Services/Clients',
49
+
'request_path' => 'app/Services/Clients/Requests',
50
+
],
51
+
```
52
+
26
53
## Understanding Extensions
27
54
28
55
Extensions follow a lazy-loading pattern. When you register an extension, the callback is stored but not executed. The extension is only instantiated when first accessed: