vwo / vwo-openfeature-provider-php
VWO Openfeature Provider for PHP
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 5
Forks: 0
Open Issues: 0
Language:JavaScript
Requires
- open-feature/sdk: ^1.3
- vwo/vwo-fme-php-sdk: ^1.2
This package is auto-updated.
Last update: 2025-02-26 10:53:54 UTC
README
Requirements
PHP >= 7.4
Installation
Install the latest version with
composer require vwo/vwo-openfeature-provider-php
Basic Usage
use OpenFeature\OpenFeatureAPI; use OpenFeature\implementation\flags\EvaluationContext; use VWOOpenFeatureProvider\VWOProvider; use vwo\VWO; class OpenFeatureTest { public static function main() { // Initialize the VWO client options $vwoInitOptions = [ 'sdkKey' => 'your-sdk-key-here', // Replace with your SDK Key 'accountId' => 123456, // Replace with your VWO Account ID ]; // Initialize VWO Client $vwoClient = VWO::init($vwoInitOptions); if ($vwoClient === null) { echo "Failed to initialize VWO Client\n"; return; } // Initialize the VWO provider $vwoProvider = new VWOProvider($vwoClient); // Set the provider using OpenFeature API $api = OpenFeatureAPI::getInstance(); $api->setProvider($vwoProvider); // Call the test flags method to evaluate different flag types self::testFlags($api); } public static function testFlags(OpenFeatureAPI $api) { // Create custom variables for the context $customVariables = [ 'name' => 'Ashley' ]; // Manually creating EvaluationContext with targetingKey and additional attributes $attributes = new OpenFeature\implementation\flags\Attributes([ 'key' => 'variable-key', 'customVariables' => $customVariables, // Custom variables ]); $context = new EvaluationContext('userId1', $attributes); // Get the client from OpenFeature API $client = $api->getClient(); // Test object flag $objectResult = $client->getObjectValue('f1',$customVariables, $context); echo "OBJECT result: " . json_encode($objectResult) . "\n"; } } // Run the OpenFeatureTest script OpenFeatureTest::main();
Changelog
Refer CHANGELOG.md
Setting up development environment
composer run-script start
Contributing
Please go through our contributing guidelines
Code of Conduct
License
Copyright 2024-2025 Wingify Software Pvt. Ltd.