Skip to content

Commit 08111bb

Browse files
authored
chore: Update Readme
1 parent d2fb38b commit 08111bb

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

Diff for: README.md

+10-21
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,15 @@
88

99
[What is JSON Schema?](https://json-schema.org/overview/what-is-jsonschema)
1010

11-
Support is limited to [draft-07](https://json-schema.org/draft-07) at the moment.
12-
1311
## Features
1412

1513
- 🏗️ **Fluent Builder API** - Build JSON Schemas using an intuitive fluent interface
16-
- 📝 **Draft-07 Support** - Full support for JSON Schema Draft-07 specification
14+
- 📝 **Draft-07 Support** - Full support for JSON Schema [Draft-07](https://json-schema.org/draft-07) specification
1715
-**Validation** - Validate data against schemas with detailed error messages
1816
- 🤝 **Conditional Schemas** - Support for if/then/else, allOf, anyOf, and not conditions
19-
- 🔄 **Reflection** - Generate schemas from PHP classes and closures
17+
- 🔄 **Reflection** - Generate schemas from PHP Classes, Enums and Closures
2018
- 💪 **Type Safety** - Built with PHP 8.3+ features and strict typing
2119

22-
## Why?
23-
24-
I found myself looking for a nice, fluent way to build JSON Schemas, but couldn't find anything that fit my needs.
25-
26-
There are many use cases, but the most prevalent right now is usage around LLMs, in particular structured outputs and tool calling.
27-
28-
In fact I'm building an AI framework currently that uses this package to generate JSON Schemas in lots of scenarios. More to come on that soon!
29-
3020
## Requirements
3121

3222
- PHP 8.3+
@@ -68,29 +58,28 @@ $schema = SchemaFactory::object('user')
6858
);
6959
```
7060

71-
You can also use the objects directly instead of the factory methods.
61+
You can also use the objects directly instead of the factory methods. (Example shows PHP 8.4 syntax)
7262

7363
```php
74-
$schema = (new ObjectSchema('user'))
64+
$schema = new ObjectSchema('user')
7565
->description('User schema')
7666
->properties(
77-
(new StringSchema('name'))
67+
new StringSchema('name')
7868
->minLength(2)
7969
->maxLength(100)
8070
->required(),
81-
(new StringSchema('email'))
71+
new StringSchema('email')
8272
->format(SchemaFormat::Email)
8373
->required(),
84-
(new IntegerSchema('age'))
74+
new IntegerSchema('age')
8575
->minimum(18)
8676
->maximum(150),
87-
(new BooleanSchema('active'))
77+
new BooleanSchema('active')
8878
->default(true),
89-
(new ObjectSchema('settings'))
79+
new ObjectSchema('settings')
9080
->additionalProperties(false)
9181
->properties(
92-
(new StringSchema('theme'))
93-
->enum(['light', 'dark']),
82+
new StringSchema('theme')->enum(['light', 'dark']),
9483
),
9584
);
9685
```

0 commit comments

Comments
 (0)