jmversteeg / contextual
Simple object-oriented contexts
Installs: 387
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
pkg:composer/jmversteeg/contextual
Requires (Dev)
- aura/autoload: ~2.0
- phpunit/phpunit: ~4.6
- satooshi/php-coveralls: 0.6.*
This package is not auto-updated.
Last update: 2025-09-27 22:28:09 UTC
README
Simple object-oriented contexts
Usage
/** * @property boolean $JSON * @property boolean $admin * @property string $type */ class ResponseContext extends \jmversteeg\contextual\Context { // Declare default values with a preceding underscore private $_JSON = false; private $_admin = false; private $_type = 'body'; } $responseContext = new ResponseContext([ 'JSON' => true, 'type' => 'ajax' ]); $responseContext->JSON; // => true $responseContext->admin; // => false $subContext = $responseContext->createSubContext([ 'admin' => true ]); $subContext->JSON; // => true $subContext->admin; // => true
License
MIT © JM Versteeg