https://github.com/psmb/psmb.registry
Global registry of things with an Eel helper
https://github.com/psmb/psmb.registry
neoscms
Last synced: about 1 month ago
JSON representation
Global registry of things with an Eel helper
- Host: GitHub
- URL: https://github.com/psmb/psmb.registry
- Owner: psmb
- License: mit
- Created: 2016-11-29T07:27:56.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T12:30:18.000Z (over 2 years ago)
- Last Synced: 2025-04-19T22:35:00.162Z (about 2 months ago)
- Topics: neoscms
- Language: PHP
- Size: 36.1 KB
- Stars: 3
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
**Use with caution and only if you absolutely have to!**
This package provides you with a registry service and an Eel helper to get and set values on it.
## Installation
`composer require psmb/registry`
## Usage
#### Example
```
root = T:Collection {
@context.blah = ${Registry.set('acc', 0)}
collection = ${[1,2,3]}
itemName = 'item'
itemRenderer = T:Value {
@context.blah = ${Registry.set('acc', item + Registry.get('acc'))}
value = ${Registry.get('acc')}
}
}
```The following methods are available:
* **set(key, value):** Sets a value by key
* **get(key):** Returns a value by key
* **getset(key, value):** Atomically sets key to value and returns the old value stored at key.
* **increment(key):** Increment a value by key
* **decrement(key):** Derement a value by keyA key can consist of a single string or a path, separated with dots which addresses a value in a nested array.