Download the PHP package rkgrep/attributable without Composer
On this page you can find all versions of the php package rkgrep/attributable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rkgrep/attributable
More information about rkgrep/attributable
Files in rkgrep/attributable
Package attributable
Short Description Fast an elegant way to make dynamic objects
License MIT
Informations about the package attributable
Attributable
Note: Original idea by Taylor Otwell in Laravel Framework.
The package includes traits which allow fluent and elegant way to work with internal object property arrays.
Installation
Install the package with composer. `
Apply the trait to any class you need.
``
``
Usage
Attributable trait
Attributable
provides different access and assignment ways.
Assign internal variables via property or method call
``
Access variables via property
``
Provide fallback value via get
method
``
Get all internal variables via getAttributes
method
``
Method call without arguments assigns true
``
Chain methods for fast assignment
``
Fillable trait
Fillable
provides chaining assignment of variables or groups of variables.
Mass assign atributes with fill
method
``
Overwrite or reassign control via second parameter
``
Fill specific properties with with
method
``
Prevent overriding with third parameter
``
Assign multiple variables
``
Chain method calls
``
Interfaces
Any class with Attributable
trait applied implements ArrayAccess
and JsonSerializable
.
If you use illuminate/support package you can also apply Arrayable
and Jsonable
interfaces.
``
License
Attributable package is open-sourced package licensed under the MIT license.