Typed callbacks work through FieldSet classes. Surqlize infers a model's fields at runtime, and can also generate explicit field adapter classes for better IDE completion and stricter static analysis.
Field adapters
A generated field adapter is a FieldSet subclass that declares each property as a typed field. It makes the closures in select(), where(), and the other builder methods fully analysable.
You write these by hand only if you want to. The generator produces them for you.
Configuration
The CLI reads a config file, by convention surqlize.config.php, that returns an array. For field generation it lists the models and where to write the adapters.
For schema:apply, the config provides the models plus an SDK executor.
CLI commands
Surqlize ships a Composer binary named surqlize.
In a source checkout without Composer's bin proxy, run the binary directly with php bin/surqlize ....
generate:fields
Generates the *Fields classes and *FieldTyping traits for the configured models, into the configured namespace and path.
schema:apply
Applies the schema definitions for the configured models through the configured executor.
memory:footprint
Generates a JSON memory report across the built-in scenarios (metadata reflection, field-set resolution, query compilation, hydration, graph traversal, and more), with retained, peak, and real memory deltas and durations.
Learn more
Querying for the typed callbacks adapters support
Schema for the definitions
schema:applyrunsLaravel integration for the Artisan schema commands