getSchema

Learn how to read the content schema.

This method gives you the content schema, when requested through withSchema.

Signature

This method has the following signature:

public function getSchema(): ?array

This method returns the content schema, or null when it was not requested.

Example

Here is a basic example of how to use this method:

<?phpuse Croct\Plug\Croct;use Croct\Plug\FetchOptions;
$croct = Croct::fromDotenv();$options = FetchOptions::defaults()->withSchema();$metadata = $croct->fetchContent('home-banner', $options)->getMetadata();$schema = $metadata->getSchema();