PHP code example of landingi / toggle-bundle

1. Go to this page and download the library: Download landingi/toggle-bundle 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/ */

    

landingi / toggle-bundle example snippets


use Landingi\ToggleBundle\AccessVoter;

class ExampleService
{
    private AccessVoter $accessVoter;
 
    public function __construct(AccessVoter $accessVoter)
    {
        $this->accessVoter = $accessVoter;
    }
    
    public function exampleMethod(string $accountUuid)
    {
        /** ... some logic  */
        
        if ($this->accessVoter->vote($accountUuid, 'EXAMPLE_FEATURE_FLAG')) {
            // Access granted
        }
    }
}