PHP code example of getsidekicker / flagr-feature-laravel

1. Go to this page and download the library: Download getsidekicker/flagr-feature-laravel 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/ */

    

getsidekicker / flagr-feature-laravel example snippets


//function
feature_eval('flag',
    on: fn(object $attachment) => // do stuff when feature is on,
    otherwise: fn(object $attachment) => // do stuff when any other variant isn't matched
)

//alias
app('feature')->eval('flag',
    on: fn(object $attachment) => // do stuff when feature is on,
    otherwise: fn(object $attachment) => // do stuff when any other variant isn't matched
);

//function
if (feature_match('flag')) {
    // do feature when feature variant is 'on'
} else  {
    // do otherwise
}

//alias
//function
if (app('feature')->match('flag')) {
    // do feature when feature variant is 'on'
} else  {
    // do otherwise
}

feature_add_context([]);
app('feature')->addContext([]);

feature_set_id('user_123');
app('feature')->setId('user_123');

// evaluation calls