PHP code example of castor / context
1. Go to this page and download the library: Download castor/context 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/ */
castor / context example snippets
use Castor\Context;
// This is a default base context
$ctx = Context\nil();
// This returns a new context with the passed values stored
$ctx = Context\withValue($ctx, 'foo', 'bar');
// Later in the call stack
echo $ctx->value('foo'); // Prints: bar