1. Go to this page and download the library: Download andersundsehr/unleash 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/ */
andersundsehr / unleash example snippets
use Unleash\Client\Unleash;
class Controller
{
public function __construct(private Unleash $unleash) {}
public function index()
{
if ($this->unleash->isEnabled('my-feature')) {
// do something
}
}
}
use TYPO3\CMS\Core\Utility\GeneralUtility;
use Unleash\Client\Unleash;
GeneralUtility::makeInstance(Unleash::class)->isEnabled('my-feature');
use Andersundsehr\Unleash\Event\UnleashBuilderBeforeBuildEvent;
class UnleashBuilderBeforeBuildEventListener
{
public function __invoke(UnleashBuilderBeforeBuildEvent $event)
{
$event->builder = $event->builder
->withAppName('my-custom-app-name');
}
}
use Andersundsehr\Unleash\Event\UnleashCustomContextEvent;
class UnleashCustomContextEventListener
{
public function __invoke(UnleashCustomContextEvent $event)
{
$event->customContext['fair'] = 'value';
}
}
use Andersundsehr\Unleash\Event\UnleashContextCreatedEvent;
class UnleashContextCreatedEventListener
{
public function __invoke(UnleashContextCreatedEvent $event)
{
$event->context->setHostname('my-custom-hostname');
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.