Download the PHP package digitalmanagerguru/laravel-json-fields without Composer

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

Laravel Json Fields (Laravel Package)

GitHub tag issues - laravel-json-fields

Laravel JSON Fieds is simple and clean way to work with Eloquent JSON Fieds with Dot Notation.

Version Compatibility

Laravel Laravel JSON Fields
10.x, 11.X [1.x]

Installation

To install, run composer require digitalmanagerguru/laravel-json-fields.

What does it support?

Usage

Importing

On a Laravel Eloquent Model import the PHP Interface Digitalmanagerguru\LaravelJsonFields\Contracts\HasJsonField then import the PHP Trait Digitalmanagerguru\LaravelJsonFields\Traits\HasJsonFieldTrait, like:

Changing the default field name

By default it maps a field called metadata, it can be changed by declaring an attribute called $jsonField like:

Methods Usage

Check if a key exists (hasJsonKey($value))

$user->hasJsonKey("addresses") //boolean

Check if the field is empty (hasJsonField())

$user->hasJsonField() //boolean

Check if a key contains a value (isEmptyJsonKeyValue($key))

$user->isEmptyJsonKeyValue("addresses.default") //boolean

Get a value from a key (getJsonKeyValue($key, $default = null))

$user->getJsonKeyValue("addresses.default", []) //any

Set a value in a key (setJsonKeyValue($key, $value))

$user->setJsonKeyValue("addresses.default", ["street" => "...."]) //void

Merge two arrays in a key (mergeJsonKeyValue($key, array $value))

$user->mergeJsonKeyValue("addresses", ["default" => [...]]) //void

Delete values from a key (forgetJsonKey($key))

$user->forgetJsonKey("addresses") //void or $user->forgetJsonKey(["addresses", "is_active"]) //void

Get all the content from the field decoded as an associative array (getJsonFieldValue())

$user->getJsonFieldValue() //array

Set all the content from and encoded associative array as JSON (setJsonFieldValue(array $value))

$user->setJsonFieldValue([...]) //void

Get the JSON field name (getJsonFieldName())

$user->getJsonFieldName() //string

Add a log entry to the field (addLog($value))

$user->addLog("Changed the is_active status") //string

License

Laravel JSON Fields is open-sourced software licensed under the MIT license.

Contributing

Please report any issue you find in the issues page. Pull requests are more than welcome.


All versions of laravel-json-fields with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3.0
illuminate/support Version *
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 digitalmanagerguru/laravel-json-fields contains the following files

Loading the files please wait ....