Skip to content

Commit

Permalink
Fix: Code examples
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Dec 4, 2023
1 parent 31f811b commit 5d776a7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ php composer.phar require optimizely/optimizely-sdk
Create the Optimizely client, for example:

```php
<?php

use Optimizely\Optimizely;

$optimizely = new Optimizely(<<DATAFILE>>);
```

Expand All @@ -56,12 +60,22 @@ $optimizelyClient = OptimizelyFactory::createDefaultInstance(
To access your HTTPProjectConfigManager:

```php
<?php

use Optimizely\Optimizely;

/** @var Optimizely $optimizelyClient */
$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
<?php

use Optimizely\Optimizely;
use Optimizely\ProjectConfigManager\HTTPProjectConfigManager;

$configManager = new HTTPProjectConfigManager(<<SDK_KEY>>);
$optimizely = new Optimizely(
<<DATAFILE>>,
Expand Down Expand Up @@ -90,6 +104,10 @@ Calling `fetch` will update the internal ProjectConfig instance that will be ret
### Use HTTPProjectConfigManager

```php
<?php

use Optimizely\ProjectConfigManager\HTTPProjectConfigManager;

$configManager = new HTTPProjectConfigManager(<<SDK_KEY>>);
```

Expand Down

0 comments on commit 5d776a7

Please sign in to comment.