diff --git a/README.md b/README.md index d7feae57..fcd3c9f1 100644 --- a/README.md +++ b/README.md @@ -28,13 +28,24 @@ To access the Feature Management configuration in the Optimizely dashboard, plea #### Initialization Create the Optimizely client, for example: -``` +```php $optimizely = new Optimizely(<>); ``` -You can also provide an implementation of the `ProjectConfigManagerInterface` in the constructor: +Or you may also use OptimizelyFactory method to create an optimizely client using your SDK key and an optional fallback datafile. Using this method internally creates an HTTPProjectConfigManager. See [HTTPProjectConfigManager](#http_config_manager) for further detail. + +```php +$optimizelyClient = OptimizelyFactory::createDefaultInstance("your-sdk-key", <>); +``` +To access your HTTPProjectConfigManager: +```php +$configManager = $optimizelyClient->configManager; ``` + +Or you can also provide an implementation of the [`ProjectConfigManagerInterface`](https://github.com/optimizely/php-sdk/blob/master/src/Optimizely/ProjectConfigManager/ProjectConfigManagerInterface.php) in the constructor: + +```php $configManager = new HTTPProjectConfigManager(<>); $optimizely = new Optimizely(<>, null, null, null, false, null, $configManager); ``` @@ -42,7 +53,7 @@ $optimizely = new Optimizely(<>, null, null, null, false, null, $confi #### ProjectConfigManagerInterface [`ProjectConfigManagerInterface`](https://github.com/optimizely/php-sdk/blob/master/src/Optimizely/ProjectConfigManager/ProjectConfigManagerInterface.php) exposes `getConfig` method for retrieving `ProjectConfig` instance. -#### HTTPProjectConfigManager +#### HTTPProjectConfigManager [`HTTPProjectConfigManager`](https://github.com/optimizely/php-sdk/blob/master/src/Optimizely/ProjectConfigManager/HTTPProjectConfigManager.php) is an implementation of `ProjectConfigManagerInterface` interface. @@ -54,7 +65,7 @@ Calling `fetch` will update the internal ProjectConfig instance that will be ret ##### Use HTTPProjectConfigManager -``` +```php $configManager = new HTTPProjectConfigManager(<>); ```