Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pointybeard/property-bag
Simplifies the task of storing key/value pairs.
https://github.com/pointybeard/property-bag
Last synced: 9 days ago
JSON representation
Simplifies the task of storing key/value pairs.
- Host: GitHub
- URL: https://github.com/pointybeard/property-bag
- Owner: pointybeard
- License: mit
- Created: 2018-09-22T04:35:59.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-19T07:55:16.000Z (almost 6 years ago)
- Last Synced: 2024-10-12T06:21:06.490Z (about 1 month ago)
- Language: PHP
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
# Property Bag
- Version: v1.0.0
- Date: Sept 22 2018
- [Release notes](https://github.com/pointybeard/property-bag/blob/master/CHANGELOG.md)
- [GitHub repository](https://github.com/pointybeard/property-bag)[![Latest Stable Version](https://poser.pugx.org/pointybeard/property-bag/version)](https://packagist.org/packages/pointybeard/property-bag) [![License](https://poser.pugx.org/pointybeard/property-bag/license)](https://packagist.org/packages/pointybeard/property-bag)
Simplifies the task of storing key/value pairs.
## Installation
Property Bag is installed via [Composer](http://getcomposer.org/). 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
```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](https://github.com/pointybeard/property-bag/issues),
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](https://github.com/pointybeard/property-bag/blob/master/CONTRIBUTING.md) for guidelines about how to get involved.
## License
"Property Bag" is released under the [MIT License](http://www.opensource.org/licenses/MIT).