Parse and validate AT Protocol Lexicons with DTO generation for Laravel
1<?php
2
3return [
4
5 /*
6 |--------------------------------------------------------------------------
7 | Schema Sources
8 |--------------------------------------------------------------------------
9 |
10 | Paths to local lexicon directories. Schemas are searched in the order
11 | specified below. Use absolute paths or Laravel path helpers.
12 |
13 */
14
15 'sources' => [
16 // Application-specific lexicons
17 resource_path('lexicons'),
18
19 // Bundled official lexicons (included with package)
20 __DIR__.'/../resources/lexicons',
21 ],
22
23 /*
24 |--------------------------------------------------------------------------
25 | Include Bundled Lexicons
26 |--------------------------------------------------------------------------
27 |
28 | Whether to include the official AT Protocol lexicons bundled with this
29 | package. Disable if you want to manage lexicons manually.
30 |
31 */
32
33 'include_bundled' => env('SCHEMA_INCLUDE_BUNDLED', true),
34
35 /*
36 |--------------------------------------------------------------------------
37 | Generation Settings
38 |--------------------------------------------------------------------------
39 |
40 | Configure how Data classes are generated from Lexicon schemas.
41 |
42 */
43
44 'generation' => [
45 // Output directory for generated Data classes
46 'output_path' => env('SCHEMA_OUTPUT_PATH', app_path('Data')),
47
48 // Base namespace for generated classes
49 'base_namespace' => env('SCHEMA_BASE_NAMESPACE', 'App\\Data'),
50
51 // Use readonly properties (PHP 8.1+)
52 'readonly_properties' => env('SCHEMA_READONLY_PROPERTIES', true),
53
54 // Generate fluent setters for immutable updates
55 'fluent_setters' => env('SCHEMA_FLUENT_SETTERS', true),
56
57 // Generate comprehensive PHPDoc blocks
58 'generate_phpdoc' => env('SCHEMA_GENERATE_PHPDOC', true),
59 ],
60
61 /*
62 |--------------------------------------------------------------------------
63 | Lexicon Generation Settings
64 |--------------------------------------------------------------------------
65 |
66 | Configure how Lexicon classes are generated from AT Protocol schemas.
67 | These settings are separate from Data class generation to allow for
68 | different organizational structures.
69 |
70 */
71
72 'lexicons' => [
73 // Output directory for generated Lexicon classes
74 'output_path' => env('SCHEMA_LEXICON_OUTPUT_PATH', app_path('Lexicons')),
75
76 // Base namespace for generated Lexicon classes
77 'base_namespace' => env('SCHEMA_LEXICON_BASE_NAMESPACE', 'App\\Lexicons'),
78 ],
79
80 /*
81 |--------------------------------------------------------------------------
82 | Bundled Pre-Generated Classes
83 |--------------------------------------------------------------------------
84 |
85 | The package includes pre-generated PHP classes for all standard
86 | AT Protocol and Bluesky lexicons in the SocialDept\AtpSchema\Generated
87 | namespace. These provide immediate type-safe access to records.
88 |
89 */
90
91 'generated' => [
92 // Namespace for bundled pre-generated classes
93 'namespace' => 'SocialDept\\AtpSchema\\Generated',
94
95 // Enable usage of bundled generated classes
96 'enabled' => env('SCHEMA_USE_GENERATED', true),
97 ],
98
99 /*
100 |--------------------------------------------------------------------------
101 | Caching Configuration
102 |--------------------------------------------------------------------------
103 |
104 | Configure caching for parsed schemas and resolved lexicons.
105 | TTL values are in seconds.
106 |
107 */
108
109 'cache' => [
110 // Enable or disable schema caching
111 'enabled' => env('SCHEMA_CACHE_ENABLED', true),
112
113 // Cache driver to use (inherits from config/cache.php if null)
114 'driver' => env('SCHEMA_CACHE_DRIVER', null),
115
116 // Cache TTL for parsed schemas (1 hour)
117 'schema_ttl' => env('SCHEMA_CACHE_TTL', 3600),
118
119 // Cache TTL for DNS resolution results (24 hours)
120 'dns_ttl' => env('SCHEMA_DNS_CACHE_TTL', 86400),
121
122 // Cache key prefix
123 'prefix' => env('SCHEMA_CACHE_PREFIX', 'schema'),
124 ],
125
126 /*
127 |--------------------------------------------------------------------------
128 | Validation Settings
129 |--------------------------------------------------------------------------
130 |
131 | Configure validation behavior for records against Lexicon schemas.
132 |
133 */
134
135 'validation' => [
136 // Default validation mode: strict, optimistic, lenient
137 'mode' => env('SCHEMA_VALIDATION_MODE', 'strict'),
138
139 // Validate on Data class construction
140 'validate_on_construct' => env('SCHEMA_VALIDATE_ON_CONSTRUCT', false),
141 ],
142
143 /*
144 |--------------------------------------------------------------------------
145 | Blob Handling
146 |--------------------------------------------------------------------------
147 |
148 | Configure blob storage and handling for ATProto blob references.
149 |
150 */
151
152 'blobs' => [
153 // Storage disk for blobs
154 'disk' => env('SCHEMA_BLOB_DISK', 'local'),
155
156 // Storage path prefix for blobs
157 'path' => env('SCHEMA_BLOB_PATH', 'blobs'),
158
159 // Lazy load blob content (don't download until accessed)
160 'lazy_load' => env('SCHEMA_BLOB_LAZY_LOAD', true),
161
162 // Blob URL signing (for temporary access URLs)
163 'signed_urls' => env('SCHEMA_BLOB_SIGNED_URLS', true),
164
165 // Signed URL expiration (in minutes)
166 'signed_url_expiration' => env('SCHEMA_BLOB_URL_EXPIRATION', 60),
167 ],
168
169 /*
170 |--------------------------------------------------------------------------
171 | DNS-Based Lexicon Resolution
172 |--------------------------------------------------------------------------
173 |
174 | Configure DNS-based lexicon resolution following AT Protocol specification.
175 |
176 | When enabled, the schema loader will attempt to discover custom lexicons via:
177 | 1. Querying DNS TXT record at _lexicon.<authority-domain> for DID
178 | 2. Resolving DID to PDS endpoint (requires socialdept/atp-resolver)
179 | 3. Fetching lexicon from repository via com.atproto.repo.getRecord
180 |
181 | IMPORTANT: DNS resolution requires the optional socialdept/atp-resolver package.
182 | Install with: composer require socialdept/atp-resolver
183 |
184 | If atp-resolver is not installed, DNS resolution will be skipped and a
185 | warning will be logged. The schema loader will fall back to local sources.
186 |
187 */
188
189 'dns_resolution' => [
190 // Enable DNS-based lexicon resolution (requires socialdept/atp-resolver)
191 'enabled' => env('SCHEMA_DNS_RESOLUTION_ENABLED', true),
192 ],
193
194 /*
195 |--------------------------------------------------------------------------
196 | HTTP Client Configuration
197 |--------------------------------------------------------------------------
198 |
199 | Configure HTTP client used for schema retrieval via XRPC.
200 |
201 */
202
203 'http' => [
204 // Request timeout (seconds)
205 'timeout' => env('SCHEMA_HTTP_TIMEOUT', 10),
206
207 // Connection timeout (seconds)
208 'connect_timeout' => env('SCHEMA_HTTP_CONNECT_TIMEOUT', 5),
209
210 // User agent for HTTP requests
211 'user_agent' => env('SCHEMA_HTTP_USER_AGENT', 'SocialDept/Schema'),
212 ],
213
214];