Download the PHP package hedronium/jables without Composer

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

Jables - BETA

For Laravel 5

Write your Database Schema in JSON, with clean naming conventions and store them nicely in Version Control.

Features

✓ Schema in JSON
✓ Laravel Integration
✓ All Laravel Field Types supported.
✓ Checking JSON Syntax
✓ Checking Foreign key References.
✓ Checking Unique key Constraints.
✓ Automatic Table Deconstruction.

Soon to come:

Installation

Grab it through Composer.

You must add Jables to Laravel as a service provider. To do this, open up your config/app.php and add hedronium\Jables\JablesServiceProvider to the Service Providers list. Like:

Testing Installation

On the command line run

and check to see if the jables command and the jables section shows up.

Usage

Commands

php artisan jables - Checks your JSON files then creates your Database Tables
php artisan jables:check - Checks your JSON files and reports errors.
php artisan jables:refresh - Destroys all the tables then recreates them from your (possibly updated) JSON files. (warning: risk of data loss)
php artisan jables:destroy - Removes all the tables that jables created from Database.
php artisan jables:create-folder - Creates the folder to store your Schema based on your configuration.
php artisan jables:create-table - Creates Jables own tracking table in database.

All the commands accept the --database=[connection] option. You can use it to override which connection Jables uses to do its business.

example

Writing Schemas

The Schema files are usually stored in the database/jables (you need to create it) folder unless you configure it to be otherwise. The Filename is your table name. So if you were to create a users table, your file name would be users.json nested under database/jables

Getting Started

food.json

now run php artisan jables. This will create a table named food with a field named name with the type being varchar.

The Formal Breakdown

Well you define all your fields in the fields property on your root object of your json file. The fields property itself is an object and every property of the fields object corresponds to a table field.

Each property (which are the field definitions) within the fields object is once again another object. The only hard requirement for it all is the type property on them. This tells jables what is the type of the field.

in our 'hello world' example the type of string corresponds to varchar just like in Laravel migrations (Jables uses Laravel's Schema Builder).

Types Available

Heres a list

integer

You can write attributes which is a list. Currently only supports one attribute, the unsigned attribute

like...

You can only set it to auto-increment with the ai (boolean) property like...

big-integer

Same as the average integer just write the type different like...

medium-integer

Same as the average integer just write the type different like...

small-integer

Same as the average integer just write the type different like...

tiny-integer

Same as the average integer just write the type different like...

float

The FLOAT type equivalent.

double

The DOUBLE type equivalent. It requires you to set the digits & precision properties.

decimal

The DECIMAL type. Properties same as double.

string

string is the VARCHAR type, and it accepts a length property like...

but the length property isn't required.

char

Its exactly like string it just uses the CHAR type but the length property is absolutely required.

text

Text doesn't require any special properties.

long-text

Same as text.

medium-text

Same as text.

date

No Special Properties.

time

No Special Properties.

date-time

No Special Properties.

timestamp

No Special Properties.

enum

for the ENUM type. It is required that you set the values(list) property.

boolean

No special properties.

json

No special properties.

jsonb

No special properties.

morphs

No special properties.

binary

No special properties.

Timestamps

Just like in Schema Builder, you can create the two fields created_at and updated_at in a simple way.

Create a special timestamps property in yours fields object and set it to true.

Like:

softDeletes

Same with softDeletes. Create a special soft-deletes property in yours fields object and set it to true.

Like:

Default Values

All field definitions accept the default property for when you want to set the default value of a field.

Used like...

Nullable Fields

All field definitions accept the nullable(boolean) property. If set to true, the field can be left null.

Used like...

Primary Keys

if you set the ai to true on a integer type or similar field. That field automatically becomes the primary key (its a Laravel thing).

Apart from that, you can set the primary property on any field to true like...

Composite Primary Keys

More that one field makes your primary key? No Problem! Just create a primary(list) property on your root object (sibling to your fields property) like...

Unique Constraints

All field definitions accept the unique property. set it to true to make it an unique field like...

Composite Unique Constraint

You can created unique constraints across many fields. Just create a unique(list) property on your root object (sibling to your fields property) like...

Yes, it is a list inside a list, for when you want multiple composite constraints.

Foreign Key Constraints

Got you covered! All fields accept the foreign property. You can set it to a string containing the name of the table and the name of the field of that table separated by a dot. (eg. users.id)

this user_id field will now reference id on the users table.

You could also define them like you define unique constraints like...

This will work totally fine.

Documenting Tables

All field and table definitions accept title and description properties that can be used to document your database schema.

We're also working on a feature that generates HTML documentation from your JSON files but for now, you gotta create it on your own. (Maybe even send us a pull request. PLEASE. WE'RE DESPERATE.)

example:

Configuration

Jables usually works right out of the box with no configuration required, but two option does exist.

First publish the configuration files. with

after running that a jables.php should show up in your config folder with the following contents...

Options

It is recommend that you store your schema in a folder within your application's database folder.


All versions of jables with dependencies

PHP Build Version
Package Version
Requires seld/jsonlint Version ^1.3
justinrainbow/json-schema Version ~1.3
symfony/yaml Version ~3.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 hedronium/jables contains the following files

Loading the files please wait ....