Download the PHP package cortexphp/json-schema without Composer

On this page you can find all versions of the php package cortexphp/json-schema. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package json-schema

banner

Fluently build and validate JSON Schemas

Latest Version GitHub Actions Test Workflow Status GitHub License

What is JSON Schema?

Support is limited to draft-07 at the moment.

Features

Why?

I found myself looking for a nice, fluent way to build JSON Schemas, but couldn't find anything that fit my needs.

There are many use cases, but the most prevalent right now is usage around LLMs, in particular structured outputs and tool calling.

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!

Requirements

Installation

Usage

You can also use the objects directly instead of the factory methods.

Available Schema Types

String Schema

View JSON Schema

Number Schema

View JSON Schema

Integer Schema

View JSON Schema

Boolean Schema

View JSON Schema

Null Schema

View JSON Schema

Array Schema

View JSON Schema

Arrays also support validation of specific items using contains:

You can also validate tuple-like arrays with different schemas for specific positions:


Object Schema

Objects support additional validation features:

Objects also support pattern-based property validation using patternProperties:

Pattern properties can be combined with regular properties and additionalProperties:

View JSON Schema

Union Schema

View JSON Schema

String Formats

Strings can be validated against various formats:


Conditional Validation

The schema specification supports several types of conditional validation:


Schema Definitions & References

You can define reusable schema components using definitions and reference them using $ref:

You can also add multiple definitions at once:

The resulting JSON Schema will include both the definitions and references:

View JSON Schema

Validation

The validate method throws a SchemaException when validation fails:

Common Schema Properties

All schema types support these common properties:

Converting to JSON Schema

This uses reflection to infer the schema from the parameters and docblocks.

From a Closure

From a Class

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of json-schema with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
opis/json-schema Version ^2.4
phpstan/phpdoc-parser Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package cortexphp/json-schema contains the following files

Loading the files please wait ....