pointybeard / property-bag
Set of classes for managing key/value pairs.
Installs: 710
Dependents: 3
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/pointybeard/property-bag
Requires
- php: >=5.6.6
This package is auto-updated.
Last update: 2025-10-20 00:53:31 UTC
README
- Version: v1.0.0
- Date: Sept 22 2018
- Release notes
- GitHub repository
Simplifies the task of storing key/value pairs.
Installation
Property Bag is installed via Composer. To install, use composer require pointybeard/property-bag or add "pointybeard/property-bag": "~1.0" to your composer.json file.
Usage Example
Here is a quick and dirty example of how to use this group of classes
include "vendor/autoload.php";
use pointybeard\PropertyBag\Lib;
$p = new Lib\PropertyBag;
$p->fruit = "apple";
$p->animal = new Lib\Property("animal", "lion");
$p->clothing = new Lib\ImmutableProperty("clothing", "hat");
var_dump($p);
$p->fruit = "banana";
var_dump($p->fruit, $p->animal->value);
try{
$p->clothing = "belt";
var_dump($p->clothing);
} catch (Lib\Exceptions\AttemptToChangeImmutablePropertyException $ex) {
print "Oh oh! You can't change Immutable property 'clothing'" . PHP_EOL;
}
print_r($p->toArray());
$p2 = new Lib\PropertyBag;
$p2->username = "barry";
$p2->password = "blahblah";
$p->credentials = $p2;
var_dump(
$p->toArray(),
$p->credentials->value->username,
$p->credentials->value->username->value
);
Support
If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.
Contributing
We encourage you to contribute to this project. Please check out the Contributing documentation for guidelines about how to get involved.
License
"Property Bag" is released under the MIT License.