Download the PHP package arm092/new-dialect without Composer

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

Dialect

Build Status Code Coverage Test Coverage

Dialect provides JSON datatype support for the Eloquent ORM. At this point this implementation is pretty bare bones and has been demonstrated to work with PostgreSQL and MySQL. There are lots of opportunities to enhance and improve. If you're interested in contributing please submit merge/pull requests.

Installation

composer require arm092/dialect

Usage

The Basics

The feature is exposed through a trait called which allows you to define attributes on the model which are of the json datatype. When the model is read in it will parse the JSON document and set up getters and setters for each top level attribute making it easy to interact with the various attributes within the document. For example we could create a Photos model like this:

And then this:

becomes this:

Also when calling the toArray() method the attributes are moved to the top level and the 'json_attributes' column is hidden. This essentially hides away the fact that you're using the json datatype and makes it look like we're working with attributes directly.

Relations

You can also establish relationships on a model like this (only supported in PostgreSQL):

Structure Hinting

Sometimes you may have an empty or partially populated record in which case the trait cannot automatically detect and create getters/setters, etc... When getting or setting an attribute not previously set in the JSON document you'll get an exception. You have two choices to deal with this. You can hint at the full structure as in the example below:

Once you create a hint you will be able to make calls to get and set json attributes e.g. $photo->foo = 'bar'; regardless of whether or not they are already defined in the underlying db record. Alternatly if you prefer not to hint structures then you may call setJsonAttribute(). For example if you defined a json column called "json_data" and wanted to set an attribute called 'fizz' so you could call:

Showing/Hiding Attributes

One of the aims of the project is to make json attributes "first class" citizens of the model. This means by default we add the attributes to the models appends array so that when you call $model->toArray() or $model->toJson() the attribute shows up as a part of the structure like a normal attribute. By default we also hide away the json column holding the underlying data. Both of these settings can be changed using the showJsonColumns() and showJsonAttributes() as shown below:


All versions of new-dialect with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/support Version 4.*|5.*|6.*|7.*
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 arm092/new-dialect contains the following files

Loading the files please wait ....