Download the PHP package bluora/laravel-model-json-column without Composer

On this page you can find all versions of the php package bluora/laravel-model-json-column. 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-model-json-column

Adds support for the JSON datatype column for models via an object based interface.

Latest Stable Version Total Downloads Latest Unstable Version Built for Laravel License

Build Status StyleCI Test Coverage Issue Count Code Climate

This package has been developed by H&H|Digital, an Australian botique developer. Visit us at hnh.digital.

Install

$ composer require hnhdigital-os/laravel-model-json ~1.0

Usage

Basic

The feature is exposed through a trait that allows you to define columns that contain JSON data. When the model is created, it generates methods using the specified column names. You can then get and set the attributes directly.

The JSON column values can then be retrieved or set via an object property.

Let's say we have an array of data stored in the settings JSON column:

Getting these values is as simple as:

Would output:

You can update any variable or add a new one:

And would update the JSON object with the following array:

Calling getDirty with true will provide changes using dot notation.

Would output:

NOTE

If you use findOrNew, firstOrNew, firstOrCreate, or the updateOrCreate method, you should run the inspectJson method before using any JSON columns as the newFromBuilder method (which we override) is not called on new model objects.

Defaults

You can define default values for a json attribute by using the $json_defaults property on the model.

You specify the attribute name and default value, if the name does not exist, it will be added at the creation of the object.

Saving changes

When a save event has been called, the trait sets the original attribute value with the latest JSON encoded value.

If you have used defaults, you can stop these from being saved to the database by setting the option no_saving_default_values to true for the specific json column

Contributing

Please see CONTRIBUTING for details.

Credits

License

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


All versions of laravel-model-json-column with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
illuminate/support Version 4.*|5.*
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 bluora/laravel-model-json-column contains the following files

Loading the files please wait ....