+113
README.md
+113
README.md
···
29
29
- **Union types** - Full support for discriminated unions with `$type` fields
30
30
- **Extensible** - Macros and hooks let you customize behavior
31
31
- **Production ready** - 818 passing tests with comprehensive coverage
32
+
- **Pre-generated classes** - Includes type-safe PHP classes for all standard AT Protocol & Bluesky lexicons
33
+
34
+
## Pre-Generated Lexicon Classes
35
+
36
+
Schema ships with pre-generated PHP classes for all standard AT Protocol and Bluesky lexicons, providing immediate type-safe access without any generation step:
37
+
38
+
```php
39
+
use SocialDept\Schema\Generated\App\Bsky\Feed\Post;
40
+
use SocialDept\Schema\Generated\App\Bsky\Graph\Follow;
41
+
use SocialDept\Schema\Generated\Com\Atproto\Repo\StrongRef;
42
+
43
+
// Create type-safe records
44
+
$post = new Post(
45
+
text: 'Hello ATP!',
46
+
createdAt: now()
47
+
);
48
+
49
+
// Create references
50
+
$ref = new StrongRef(
51
+
uri: 'at://did:plc:example/app.bsky.feed.post/123',
52
+
cid: 'bafyreic3...'
53
+
);
54
+
55
+
// Validate and use
56
+
Schema::validate('app.bsky.feed.post', $post); // true
57
+
```
58
+
59
+
### Available Pre-Generated Classes
60
+
61
+
Schema includes **220+ pre-generated classes** covering all standard AT Protocol and Bluesky lexicons:
62
+
63
+
**Record Types (`SocialDept\Schema\Generated\App\Bsky\*`)**
64
+
- `Feed\Post` - Social media posts
65
+
- `Feed\Like` - Like records
66
+
- `Feed\Repost` - Repost records
67
+
- `Graph\Follow` - Follow relationships
68
+
- `Graph\Block` - Block records
69
+
- `Graph\List` - User lists
70
+
- `Graph\Listitem` - List items
71
+
- `Labeler\Service` - Labeler service records
72
+
73
+
**Embed Types**
74
+
- `Embed\Images` - Image embeds
75
+
- `Embed\External` - External link embeds
76
+
- `Embed\Record` - Record embeds
77
+
- `Embed\RecordWithMedia` - Record with media embeds
78
+
- `Embed\Video` - Video embeds
79
+
80
+
**Feed & Post Views (`App\Bsky\Feed\Defs\*`)**
81
+
- `PostView` - Post with engagement metrics
82
+
- `FeedViewPost` - Post in feed context
83
+
- `ThreadViewPost` - Post in thread context
84
+
- `ReplyRef` - Reply references
85
+
- `ViewerState` - User's interaction state
86
+
87
+
**Actor & Profile Views (`App\Bsky\Actor\Defs\*`)**
88
+
- `ProfileView` - Full profile view
89
+
- `ProfileViewBasic` - Basic profile view
90
+
- `ProfileViewDetailed` - Detailed profile view
91
+
- `ViewerState` - Viewer's relationship to profile
92
+
- Plus 25+ preference and state classes
93
+
94
+
**Graph & Social Views (`App\Bsky\Graph\Defs\*`)**
95
+
- `ListView` - List views
96
+
- `ListItemView` - List item views
97
+
- `Relationship` - User relationships
98
+
- `StarterPackView` - Starter pack views
99
+
100
+
**Rich Text (`App\Bsky\Richtext\Facet\*`)**
101
+
- `Facet` - Text annotations (mentions, URLs, hashtags)
102
+
- `Mention` - User mention facets
103
+
- `Link` - URL link facets
104
+
- `Tag` - Hashtag facets
105
+
106
+
**AT Protocol Core (`Com\Atproto\*`)**
107
+
- `Repo\StrongRef` - Content-addressed record references
108
+
- `Repo\Defs\CommitMeta` - Repository commit metadata
109
+
- `Label\Defs\Label` - Content labels
110
+
- `Admin\Defs\*` - Administrative tools (20+ classes)
111
+
- `Sync\SubscribeRepos\*` - Repository sync events (6+ classes)
112
+
- `Server\Defs\*` - Server definitions
113
+
114
+
**Moderation (`Tools\Ozone\*`)**
115
+
- `Moderation\Defs\*` - Moderation definitions
116
+
- `Communication\Defs\*` - Moderation communication
117
+
118
+
### Generated Enums
119
+
120
+
Schema also generates PHP 8.1+ enums for string types with known values:
121
+
122
+
**Moderation**
123
+
- `Com\Atproto\Moderation\ReasonType` - Report reason types (spam, violation, etc.)
124
+
- `Com\Atproto\Moderation\SubjectType` - Report subject types (account, record, chat)
125
+
126
+
**Labels & Content**
127
+
- `Com\Atproto\Label\LabelValue` - Content label values
128
+
129
+
**Graph & Social**
130
+
- `App\Bsky\Graph\ListPurpose` - List purpose types (modlist, curatelist)
131
+
- `App\Bsky\Actor\MutedWordTarget` - Muted word target types
132
+
133
+
**Moderation Tools**
134
+
- `Tools\Ozone\Moderation\SubjectReviewState` - Review state values
135
+
136
+
### Publishing Source Lexicons
137
+
138
+
Developers can optionally publish the source JSON lexicons to their project for reference or custom generation:
139
+
140
+
```bash
141
+
php artisan vendor:publish --tag=atp-lexicons
142
+
```
143
+
144
+
This copies all lexicon JSON files to `resources/lexicons/`.
32
145
33
146
## Quick Example
34
147
+19
config/schema.php
+19
config/schema.php
···
79
79
80
80
/*
81
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\Schema\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\\Schema\\Generated',
94
+
95
+
// Enable usage of bundled generated classes
96
+
'enabled' => env('SCHEMA_USE_GENERATED', true),
97
+
],
98
+
99
+
/*
100
+
|--------------------------------------------------------------------------
82
101
| Caching Configuration
83
102
|--------------------------------------------------------------------------
84
103
|