Class SimpleID\Store\StoreManager

extends Prefab

Singleton class that manages data storage.

Each item that can be stored in SimpleID is identified using an item type and an identifier unique to that type. An item is typically (but is not required to be) represented by a class implementing the Storable interface.

A mechanism used to store or retrieve an item (such as a file system, a LDAP directory or a database) is called a store. A store is identified using the format name:method, where name represents the item type or the group of item types it is able to store or retrieve and method represents the operation (read or write). default is used as a special method to denote the store to use when no other stores with read or write operation can be found for that store name.

A store module is a subclass of StoreModule that implements one or more stores. The stores that a store module implements can be found using the StoreModule::getStores() method.

The use of stores means that multiple store modules can be enabled, with each handling a particular store, with a default store acting as a fallback for each type.

Currently the following stores a defined. The stores in bold are required to be implemented for SimpleID to function.

  • user:read (read from a directory of users)
  • user:write
  • client:read (read client data)
  • client:write (write client data)
  • keyvalue:read (read key-value data)
  • keyvalue:write (write key-value data)

These stores are implemented by DefaultStoreModule .

Data can be loaded and saved using the methods loadXX(), saveXX() deleteXX(), where XX is the item type in camel case. These are implemented using the magic method __call() , which calls load() , save() and delete() .

Special cases

  • Users. User data are split across two stores: user:read/write and user_cfg:read/write (which defaults to keyvalue:read/write). user_cfg is the store used by SimpleID to write its own data on users (e.g. user preferences and past activity). Splitting user data across two stores enable the use of a read-only directory service (e.g. LDAP) for directory information (user:read) while using another storage mechanism for preferences (user_cfg:read/write).

  • Settings. Convenience methods getSetting() , setSetting() and deleteSetting() are provided.

  • Prefab
    • SimpleID\Store\StoreManager
Methods
Constants
Properties