Download the PHP package carsdotcom/laravel-json-schema without Composer

On this page you can find all versions of the php package carsdotcom/laravel-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 laravel-json-schema

laravel-json-schema

Use JsonSchema in Laravel apps

Purpose

This library builds on the outstanding JsonSchema validator opis/json-schema

The entire intent of this library is to make JsonSchema feel like a first class citizen in a Laravel project.

Laravel Version Compatibility

This package supports Laravel v9+.

Installation

Using Laravel JSON Schema

Setup

Config File

Copy the json-schema.php file from the vendor/carsdotcom/laravel-json-schema/config folder to your application's config folder.

Schema Storage

  1. Create a Schemas folder under your application root folder, such as app/Schemas.
  2. Create a new storage disk under the disks key within your application's config/filesystem.php file:

  3. Add your schema files to the app/Schemas folder. You may create subfolders to keep things organized.

Generate Enum Schemas

This is an optional step, but can be super helpful.

Note: Enums must be created either as a built-in PHP enum object or a MyCLabs\Enum\Enum class.

  1. Add use Carsdotcom\JsonSchemaValidation\Traits\GeneratesSchemaTrait; to the declarations in the Enum.
  2. Add a SCHEMA constant to the enum. It's value will be the relative path to your schema file, such as: const SCHEMA = '/Acme/Enums/item_type.json';
  3. Run the schema:generate Artisan command.

Validating JSON Data Against a Schema

For this example, we'll be using these objects:

Hosted JSON Schema File

This is assumed to be stored in your app/Schemas folder as Product.json.

JSON Data to be Validated

Application Code for Validation

Additional Functionality

Getting the Content of a Schema File

Storing a Schema File at a Specific Location

Adding an In-Memory Schema File


All versions of laravel-json-schema with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version ^9.19 || ^10.0 || ^11.0
opis/json-schema Version ^2.3
php Version ^8.1
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 carsdotcom/laravel-json-schema contains the following files

Loading the files please wait ....