-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.php
More file actions
28 lines (25 loc) · 819 Bytes
/
api.php
File metadata and controls
28 lines (25 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
use Illuminate\Support\Facades\Route;
use Inertia\Inertia;
use OpenFeature\OpenFeatureAPI;
use OpenFeature\Providers\Flagd\FlagdProvider;
use OpenFeature\Providers\Flagd\config\HttpConfig;
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\HttpFactory;
Route::get('/hello', function () {
$api = OpenFeatureAPI::getInstance();
$httpClient = new Client();
$httpFactory = new HttpFactory();
$api->setProvider(new FlagdProvider([
'httpConfig' => new HttpConfig(
$httpClient,
$httpFactory,
$httpFactory,
)
]));
$client = $api->getClient();
if($client->getBooleanValue("welcome-message", false)){
return response()->json(['message' => 'Hello, World! open feature']);
}
return response()->json(['message' => 'Hello, World!']);
});