PHPackages                             jgswift/qub - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jgswift/qub

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jgswift/qub
===========

PHP 5.5+ magic mediator and native state transformation utility

0.1.1(12y ago)115MITPHPPHP &gt;=5.5

Since Apr 22Pushed 11y ago1 watchersCompare

[ Source](https://github.com/jgswift/qub)[ Packagist](https://packagist.org/packages/jgswift/qub)[ RSS](/packages/jgswift-qub/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

qub
===

[](#qub)

PHP 5.5+ magic mediator and native state transformation utility

[![Build Status](https://camo.githubusercontent.com/eeaad3a90c4cb8854442a0a70a64bc98d360f6f6d361d7697a7de68f88e22ed2/68747470733a2f2f7472617669732d63692e6f72672f6a6773776966742f7175622e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/jgswift/qub)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/10ed357950839aef11d5567a5ebc78e99e635ee6adb54bf81668ad85c30d692e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a6773776966742f7175622f6261646765732f7175616c6974792d73636f72652e706e673f733d36656533303937333935616465636137356336613638623039343064383664636166643564373931)](https://scrutinizer-ci.com/g/jgswift/qub/)

Installation
------------

[](#installation)

Install via [composer](https://getcomposer.org/):

```
php composer.phar require jgswift/qub:dev-master
```

Description
-----------

[](#description)

qub is a relatively simple utility that mediates state machines for any given object

qub constitutes a flexible and non-invasive way to associate potentially disparate (well formed) systems

qub is conceptually similar to the many-to-many or joint-table pattern found in relational database theory

qub adds conceptually barely anything to object-oriented programming in php but has many conceivable applications

qub uses 3 transformations to modify state and they are ASK, TELL, and TRANSLATE respectively

qub provides 4 drivers to run transformations immediately (run-time) or from stored lists (collections/queues/stacks)

qub can mediate both object and arrayaccess magic with comparable performance

Transformations
---------------

[](#transformations)

Ask - requests state information from mediator

Tell - instructs mediator to update it's internal state

Translate - requests translated information. should always result in identical output given the same arguments

Usage
-----

[](#usage)

This is minimal example of a user being asked what it's name is using the run-time state driver

```
