Fresh code drop

Build multi-type JSON schemas

PHP

Laravel 13 API example based on official Laravel documentation. Source: https://laravel.com/framework/docs/changelog#add-multi-type-union-support-to-illuminatejsonschema

PHP
CodeSnap // free canvas

Build multi-type JSON schemas

<?php

use Illuminate\JsonSchema\JsonSchema;

$identifier = JsonSchema::union([
    'string',
    'number',
])->nullable();

// Further reading: https://laravel.com/framework/docs/changelog#add-multi-type-union-support-to-illuminatejsonschema

Turn your code into a post.Five templates are free—no account needed.

Remix this snap