PHP code example of pod-point / laravel-configcat

1. Go to this page and download the library: Download pod-point/laravel-configcat 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/ */

    

pod-point / laravel-configcat example snippets


use PodPoint\ConfigCat\Facades\ConfigCat;

$flag = ConfigCat::get('new_registration_flow');

$flag = configcat('new_registration_flow');

use PodPoint\ConfigCat\Facades\ConfigCat;

$flag = ConfigCat::get('new_registration_flow', true);

$flag = configcat('new_registration_flow', true);

Validator::make([
    'email' => '[email protected]',
    'username' => 'taylor',
], [
    'email' => '

Router::get('/registration')->middleware('configcat.on:new_registration_flow');

Router::get('/sign-up')->middleware('configcat.off:new_registration_flow');

'user' => \PodPoint\ConfigCat\Support\DefaultUserTransformer::class,

class DefaultUserTransformer
{
    public function __invoke(\Illuminate\Foundation\Auth\User $user)
    {
        return new \ConfigCat\User($user->getKey(), $user->email);
    }
}

use App\Models\User;
use PodPoint\ConfigCat\Facades\ConfigCat;

$user = User::where('email', '[email protected]')->firstOrFail();
ConfigCat::get('new_registration_flow', $default, $user);

configcat('new_registration_flow', $default, $user);

use PodPoint\ConfigCat\Facades\ConfigCat;

ConfigCat::shouldReceive('get')
    ->once()
    ->with('new_registration_flow')
    ->andReturn(true);

use PodPoint\ConfigCat\Facades\ConfigCat;

// you can fake it
ConfigCat::fake();
// optionally setup some predefined feature flags for your test
ConfigCat::fake(['new_registration_flow' => true]);

use PodPoint\ConfigCat\Facades\ConfigCat;

ConfigCat::override(['new_registration_flow' => true]);
bash
php artisan vendor:publish --provider="PodPoint\ConfigCat\ConfigCatServiceProvider"