PHP code example of codegaudi / laravel-feature-flags

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

    

codegaudi / laravel-feature-flags example snippets


use Codegaudi\LaravelFeatureFlags\Facades;

Feature::add($name = 'my-feature', $isEnabled = true);

use Codegaudi\LaravelFeatureFlags\Facades;

Feature::findByName('my-feature');

use Codegaudi\LaravelFeatureFlags\Facades;

Feature::enable('my-feature');
Feature::disable('my-feature');

Feature::isEnabled('my-feature');
Feature::isDisabled('my-feature');

Feature::remove('my-feature');

use Codegaudi\LaravelFeatureFlags\Traits\HasFeatures;

class User extends Model
{
    use HasFeatures;
}

$user = User::first();
$user->enableFeature(Feature::findByName('my-feature'));
bash
php artisan vendor:publish --provider="Codegaudi\LaravelFeatureFlags\LaravelFeatureFlagsServiceProvider" --tag="migrations"
php artisan migrate