PHP code example of bytexr / laravel-pennant-launchdarkly
1. Go to this page and download the library: Download bytexr/laravel-pennant-launchdarkly 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/ */
bytexr / laravel-pennant-launchdarkly example snippets
return [
...
'launch-darkly' => [
'key' => env('LAUNCH_DARKLY_KEY'),
'options' => [],
]
];
'stores' => [
...
'launch-darkly' => [
'driver' => 'launch-darkly'
]
]
class User extends Authenticatable implements HasLaunchDarklyContext
{
...
public function getLaunchDarklyContext(): LDContext|LDUser
{
return (new LDUserBuilder($this->getKey()))
->email($this->email)
->build();
}
// OR if you would like to use context instead
public function getLaunchDarklyContext(): LDContext|LDUser
{
return LDContext::builder('user')
->set('email', $this->email)
->build();
}
}