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

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

JSON database schema for Laravel

Build Status Coverage Status Latest Stable Version Latest Unstable Version License Total Downloads

Create all your migrations and models from one JSON schema file. This package allows you to define your entire Laravel database schema in one JSON file then generates all the necessary migration files. Makes use of Jeffrey Way's Extended Generators.

preview-01

Versions

For Laravel 5.4.x and above use laravel-json-schema tag 5.4.x. You might need to set your composer.json minimum-stability to dev :

For Laravel 5.3.x and below use laravel-json-schema tag 1.x.x

Installation

Step 1: Add package via composer

Add this package to your composer.json file with the following command

Step 2: Add the service providers

Add the following 2 service providers to your local environment only, by modifying your as so:

Usage

Create your schema in JSON

Create your JSON schema file and save as for example:

Generate your migrations

If you have your JSON file, you can now generate all your migrations, using the option to specify where the JSON file is located:

After this command executes you will see all the newly created migration files, example output:

If you have a extensive long schema json file and want to only generate specific tables or migrations from the schema, you would do the following:

In the above example, the tables or migrations named "categories" and "tags" will be generated and all other tables/migrations will be ignored.

Pivot tables

If you need to generate a pivot table, you will append to your migration name, for example:

This will create a pivot table migration for the tables and

Undo

To undo and delete all files that where previously generated with the json file that was used, example:

What this will do is look for the file if it exists, read the contents and remove all files that where generated, example output:

If you prefer not to create a "undo file" in the same directory as the source json file, use the option at the time of migration generation:

This will prevent the creation of a undo file.

Validation

To check your json file for valid json syntax and schema validation (column type definitions and column type modifiers checks):

Note: this does not generate any migration files and will just check if you misspelled any field schema definitions

JSON File Examples

Using table names or migration names

You can use table names or use a migration name that Extended Generators will understand.

For example:

Is the same as:

Putting it all together

You can now get crazy with defining your entire database schema and having the benefit of seeing it all in one file. As you have seen we can to remove all previously generated files from the last command then make edits to our JSON file, validate the syntax with and then generate it all over again. One word: WOW. :)


All versions of laravel-json-schema with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/support Version ~5.0
illuminate/filesystem Version ~5.0
illuminate/database Version ~5.0
laracasts/generators Version dev-master#4e9ce5db9d93475ca27b993a92de3b15090aa139
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 mojopollo/laravel-json-schema contains the following files

Loading the files please wait ....