Documentation Index
Fetch the complete documentation index at: https://mintlify.com/phpaisdk/core/llms.txt
Use this file to discover all available pages before exploring further.
Schema is a single, fluent class that covers all JSON Schema node types. Rather than a hierarchy of per-type classes, it uses static factory methods to create typed nodes and chainable modifier methods to apply constraints. A Schema instance can describe a primitive value, an array, an object with nested properties, or an enumerated string — and can convert itself to a provider-ready JSON Schema array via jsonSchema().
Constants
| Constant | Value |
|---|---|
Schema::TYPE_STRING | 'string' |
Schema::TYPE_INTEGER | 'integer' |
Schema::TYPE_NUMBER | 'number' |
Schema::TYPE_BOOLEAN | 'boolean' |
Schema::TYPE_ARRAY | 'array' |
Schema::TYPE_OBJECT | 'object' |
Schema::TYPE_NULL | 'null' |
Factory methods
string()
Create a string schema node.
The property name used when this schema is nested inside an object or tool input.
Human-readable description forwarded into the JSON Schema
description field.integer()
Create an integer schema node.
Property name for use inside an object.
Human-readable description.
number()
Create a floating-point number schema node.
Property name for use inside an object.
Human-readable description.
boolean()
Create a boolean schema node.
Property name for use inside an object.
Human-readable description.
array()
Create an array schema node whose items match a given inner schema.
The schema that every element in the array must conform to.
Property name for use inside an object.
Human-readable description.
object()
Create an object schema node with named properties.
The name of this object schema. Required and must be non-empty.
Human-readable description of this object.
An indexed array of named
Schema instances. Each property must have a non-empty name. Throws InvalidArgumentException if any property is unnamed or is not a Schema instance.enum()
Create an enumerated string schema that constrains values to a fixed list.
A non-empty list of allowed string values. Throws
InvalidArgumentException when empty.Property name for use inside an object.
Human-readable description.
Modifiers
required()
Mark this schema node as required when it is a property of an object. Returns a new instance (the original is not mutated).
nullable()
Allow this schema to also accept null values. In the generated JSON Schema, the type becomes an array [originalType, 'null']. Returns a new instance.
Accessors
name()
Return the name assigned to this schema node.
The schema node’s name, or
null if none was given.description()
Return the description string, if one was set.
The description text, or
null.type()
Return the JSON Schema type string for this node.
One of the
TYPE_* constants, e.g. 'string', 'integer', 'object', 'array'.isRequired()
Return whether this schema has been marked as required.
true if required() was called on this node.isNullable()
Return whether this schema permits null values.
true if nullable() was called on this node.items()
Return the inner item schema for array nodes.
The schema describing each array element, or
null if this is not an array node.properties()
Return the named property schemas for object nodes, keyed by name.
An associative array mapping property names to their
Schema instances. Returns an empty array for non-object nodes.enumValues()
Return the list of allowed enum values, or null for non-enum nodes.
An indexed array of allowed string values, or
null if this node is not an enum.jsonSchema()
Convert this schema node into a plain PHP array representing a JSON Schema document. This is the format passed to AI providers.
A JSON Schema-compatible associative array. Object schemas include
properties, required field lists, and additionalProperties: false. Nullable schemas use an array type. Array schemas include an items key.