PHP code example of jmversteeg / contextual
1. Go to this page and download the library: Download jmversteeg/contextual library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jmversteeg / contextual example snippets
/**
* @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