Skip to content

[FSSDK-8963] doc: Full Stack to Feature Experimentation Rename #261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 49 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,43 @@
# Optimizely PHP SDK
[![Packagist](https://badgen.net/packagist/v/optimizely/optimizely-sdk)](https://packagist.org/packages/optimizely/optimizely-sdk)
[![Build Status](https://travis-ci.org/optimizely/php-sdk.svg?branch=master)](https://travis-ci.org/optimizely/php-sdk)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: take same approach as other SDK (Flutter?) and remove build badge until it's not failing?

[![Coverage Status](https://coveralls.io/repos/github/optimizely/php-sdk/badge.svg?branch=master)](https://coveralls.io/github/optimizely/php-sdk?branch=master)
[![Total Downloads](https://poser.pugx.org/optimizely/optimizely-sdk/downloads)](https://packagist.org/packages/optimizely/optimizely-sdk)
[![Apache 2.0](https://img.shields.io/github/license/nebula-plugins/gradle-extra-configurations-plugin.svg)](http://www.apache.org/licenses/LICENSE-2.0)

This repository houses the PHP SDK for use with Optimizely Full Stack and Optimizely Rollouts.
This repository houses the PHP SDK for use with Optimizely Feature Experimentation and Optimizely Full Stack (legacy).

Optimizely Full Stack is A/B testing and feature flag management for product development teams. Experiment in any application. Make every feature on your roadmap an opportunity to learn. Learn more at https://www.optimizely.com/platform/full-stack/, or see the [documentation](https://docs.developers.optimizely.com/full-stack/docs).
Optimizely Feature Experimentation is an A/B testing and feature management tool for product development teams that enables you to experiment at every step. Using Optimizely Feature Experimentation allows for every feature on your roadmap to be an opportunity to discover hidden insights. Learn more at [Optimizely.com](https://www.optimizely.com/products/experiment/feature-experimentation/), or see the [developer documentation](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/welcome).

Optimizely Rollouts is free feature flags for development teams. Easily roll out and roll back features in any application without code deploys. Mitigate risk for every feature on your roadmap. Learn more at https://www.optimizely.com/rollouts/, or see the [documentation](https://docs.developers.optimizely.com/rollouts/docs).
Optimizely Rollouts is [free feature flags](https://www.optimizely.com/free-feature-flagging/) for development teams. You can easily roll out and roll back features in any application without code deploys, mitigating risk for every feature on your roadmap.

## Getting Started
## Get Started

### Installing the SDK
Refer to the [PHP SDK's developer documentation](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/php-sdk) for detailed instructions on getting started with using the SDK.

### Requirements

To access the Feature Management configuration in the Optimizely dashboard, please contact your Optimizely account executive.

### Install the SDK

The Optimizely PHP SDK can be installed through [Composer](https://getcomposer.org/). Please use the following command:

```
```bash
php composer.phar require optimizely/optimizely-sdk
```

### Feature Management Access
To access the Feature Management configuration in the Optimizely dashboard, please contact your Optimizely account executive.
## Use the PHP SDK

### Using the SDK
### Initialization

#### Initialization
Create the Optimizely client, for example:

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

Or you may also use OptimizelyFactory method to create an optimizely client using your SDK key, an optional fallback datafile and an optional datafile access token. Using this method internally creates an HTTPProjectConfigManager. See [HTTPProjectConfigManager](#http_config_manager) for further detail.
Or you may also use OptimizelyFactory method to create an optimizely client using your SDK key, an optional fallback datafile and an optional datafile access token. Using this method internally creates an HTTPProjectConfigManager. See [HTTPProjectConfigManager](#use-httpprojectconfigmanager) for further detail.

```php
$optimizelyClient = OptimizelyFactory::createDefaultInstance("your-sdk-key", <<DATAFILE>>, <<DATAFILE_AUTH_TOKEN>>);
Expand All @@ -50,10 +55,10 @@ $configManager = new HTTPProjectConfigManager(<<SDK_KEY>>);
$optimizely = new Optimizely(<<DATAFILE>>, null, null, null, false, null, $configManager);
```

#### ProjectConfigManagerInterface
### ProjectConfigManagerInterface
[`ProjectConfigManagerInterface`](https://github.com/optimizely/php-sdk/blob/master/src/Optimizely/ProjectConfigManager/ProjectConfigManagerInterface.php) exposes `getConfig` method for retrieving `ProjectConfig` instance.

#### <a name="http_config_manager"></a> HTTPProjectConfigManager
### <a name="http_config_manager"></a> HTTPProjectConfigManager

[`HTTPProjectConfigManager`](https://github.com/optimizely/php-sdk/blob/master/src/Optimizely/ProjectConfigManager/HTTPProjectConfigManager.php)
is an implementation of `ProjectConfigManagerInterface` interface.
Expand All @@ -63,31 +68,53 @@ project datafile and initialize an instance of the ProjectConfig.

Calling `fetch` will update the internal ProjectConfig instance that will be returned by `getConfig`.

##### Use HTTPProjectConfigManager
### Use HTTPProjectConfigManager

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

##### SDK key
### SDK key
Optimizely project SDK key; required unless source URL is overridden.

A notification will be triggered whenever a _new_ datafile is fetched and ProjectConfig is updated. To subscribe to these notifications, use the `$notificationCenter->addNotificationListener(NotificationType::OPTIMIZELY_CONFIG_UPDATE, $updateCallback)`.

#### Documentation
See the Optimizely Full Stack [developer documentation](https://developers.optimizely.com/x/solutions/sdks/reference/?language=php) to learn how to set up your first Full Stack project and use the SDK.
## SDK Development

## Development
### Unit Tests

### Unit tests

##### Running all tests
You can run all unit tests with:

```
```bash
./vendor/bin/phpunit
```

### Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md).

### Other Optimizely SDKs

- Agent - https://github.com/optimizely/agent

- Android - https://github.com/optimizely/android-sdk

- C# - https://github.com/optimizely/csharp-sdk

- Flutter - https://github.com/optimizely/optimizely-flutter-sdk

- Go - https://github.com/optimizely/go-sdk

- Java - https://github.com/optimizely/java-sdk

- JavaScript - https://github.com/optimizely/javascript-sdk

- PHP - https://github.com/optimizely/php-sdk

- Python - https://github.com/optimizely/python-sdk

- React - https://github.com/optimizely/react-sdk

- Ruby - https://github.com/optimizely/ruby-sdk

- Swift - https://github.com/optimizely/swift-sdk
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "optimizely/optimizely-sdk",
"description": "Optimizely SDK for Full Stack PHP projects.",
"description": "Optimizely PHP SDK for Optimizely Feature Experimentation, Optimizely Full Stack (legacy), and Optimizely Rollouts.",
"keywords": ["optimizely", "sdk"],
"license": "Apache-2.0",
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion src/Optimizely/Config/DatafileProjectConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class DatafileProjectConfig implements ProjectConfigInterface
private $_accountId;

/**
* @var string Project ID of the Full Stack project.
* @var string Project ID of the Feature Experimentation project.
*/
private $_projectId;

Expand Down
2 changes: 1 addition & 1 deletion src/Optimizely/Optimizely.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class Optimizely
public $notificationCenter;

/**
* Optimizely constructor for managing Full Stack PHP projects.
* Optimizely constructor for managing Feature Experimentation PHP projects.
*
* @param $datafile string JSON string representing the project.
* @param $eventDispatcher EventDispatcherInterface
Expand Down