diff --git a/docs/home/feature-management/edgedb/edge-flags.md b/docs/home/feature-management/edgedb/edge-flags.md index 578167da..b8c122a5 100644 --- a/docs/home/feature-management/edgedb/edge-flags.md +++ b/docs/home/feature-management/edgedb/edge-flags.md @@ -88,7 +88,7 @@ For specific documentation on how to use Edge Flags with each SDK - [Go SDK](/sdk/server-side-sdks/go#edgedb) - [Java SDK](/sdk/server-side-sdks/java-cloud#edgedb) - [Node.js SDK](/sdk/server-side-sdks/node#edgedb) -- [PHP SDK](/sdk/server-side-sdks/php#edgedb) +- [PHP SDK](/sdk/server-side-sdks/php/php-usage#edgedb) - [Python SDK](/sdk/server-side-sdks/python#edgedb) - [Ruby SDK](/sdk/server-side-sdks/ruby#edgedb) - [.NET SDK for Cloud Bucketing](/sdk/server-side-sdks/dotnet-cloud#edgedb) diff --git a/docs/sdk/example-apps.md b/docs/sdk/example-apps.md index e58f8642..56b0a410 100644 --- a/docs/sdk/example-apps.md +++ b/docs/sdk/example-apps.md @@ -21,7 +21,7 @@ Welcome to the Samples & Example Apps page, which showcases example applications | [Java (Local Bucketing)](https://github.com/DevCycleHQ/java-server-sdk) | [Java (Local Bucketing) Reference Docs](/sdk/server-side-sdks/java-local.md) | | [Javascript](https://github.com/DevCycleHQ/js-sdks/tree/main/sdk/js) | [Javascript Reference Docs](/sdk/client-side-sdks/javascript/javascript.md) | | [NodeJS](https://github.com/DevCycleHQ/js-sdks/tree/main/sdk/nodejs) | [NodeJS Reference Docs](/sdk/server-side-sdks/node.md) | -| [PHP](https://github.com/DevCycleHQ/php-server-sdk) | [PHP Reference Docs](/sdk/server-side-sdks/php.md) | +| [PHP](https://github.com/DevCycleHQ/php-server-sdk) | [PHP Reference Docs](/sdk/server-side-sdks/php/php.md) | | [Python](https://github.com/DevCycleHQ/python-server-sdk) | [Python Reference Docs](/sdk/server-side-sdks/python.md) | | [React](https://github.com/DevCycleHQ/js-sdks/tree/main/examples/react) | [React Reference Docs](/sdk/client-side-sdks/react.md) | | [React Native](https://github.com/DevCycleHQ/js-sdks/tree/main/examples/react/react-native-app) | [React Native Reference Docs](/sdk/client-side-sdks/react-native.md) | diff --git a/docs/sdk/features/all-features.md b/docs/sdk/features/all-features.md index 1c20aed3..afed4ebe 100644 --- a/docs/sdk/features/all-features.md +++ b/docs/sdk/features/all-features.md @@ -65,7 +65,7 @@ The DevCycle React SDK is built upon the JavaScript SDK. For more details, view ### [• Ruby SDK](/sdk/server-side-sdks/ruby#getting-all-features) -### [• PHP SDK](/sdk/server-side-sdks/php#getting-all-features) +### [• PHP SDK](/sdk/server-side-sdks/php/php-usage#getting-all-features) ### [• .NET / C# Cloud SDK](/sdk/server-side-sdks/dotnet-cloud#getting-all-features) diff --git a/docs/sdk/features/all-variables.md b/docs/sdk/features/all-variables.md index d140c926..358e60ab 100644 --- a/docs/sdk/features/all-variables.md +++ b/docs/sdk/features/all-variables.md @@ -65,7 +65,7 @@ The DevCycle React SDK is built upon the JavaScript SDK. For more details, view ### [• Ruby SDK](/sdk/server-side-sdks/ruby#getting-all-variables) -### [• PHP SDK](/sdk/server-side-sdks/php#getting-all-variables) +### [• PHP SDK](/sdk/server-side-sdks/php/php-usage#get-all-variables) ### [• .NET / C# Cloud SDK](/sdk/server-side-sdks/dotnet-cloud#getting-all-variables) diff --git a/docs/sdk/features/evaluating.md b/docs/sdk/features/evaluating.md index d35c88af..31cae0f5 100644 --- a/docs/sdk/features/evaluating.md +++ b/docs/sdk/features/evaluating.md @@ -37,7 +37,7 @@ If there is an error reaching DevCycle, if the requested variable does not exist ### [• Ruby SDK](/sdk/server-side-sdks/ruby#get-and-use-variable-by-key) -### [• PHP SDK](/sdk/server-side-sdks/php#get-and-use-variable-by-key) +### [• PHP SDK](/sdk/server-side-sdks/php/php-usage#get-and-use-variable-by-key) ### [• Java Local SDK](/sdk/server-side-sdks/java-local#get-and-use-variable-by-key) diff --git a/docs/sdk/features/identify.md b/docs/sdk/features/identify.md index 7e44a47b..9bb62f63 100644 --- a/docs/sdk/features/identify.md +++ b/docs/sdk/features/identify.md @@ -99,7 +99,7 @@ As well, unlike the Client-Side SDKs, because Server-Side SDKs poll for project ### [• Ruby SDK](/sdk/server-side-sdks/ruby#user-object) -### [• PHP SDK](/sdk/server-side-sdks/php#user-object) +### [• PHP SDK](/sdk/server-side-sdks/php/php-usage#user-object) ### [• Java Local SDK](/sdk/server-side-sdks/java-local#user-object) diff --git a/docs/sdk/features/initialization.md b/docs/sdk/features/initialization.md index 43fe8c59..b04161ab 100644 --- a/docs/sdk/features/initialization.md +++ b/docs/sdk/features/initialization.md @@ -47,7 +47,7 @@ If a variable is first read from the cache and has a listener for [realtime upda ### [• Ruby SDK](/sdk/server-side-sdks/ruby#installation) -### [• PHP SDK](/sdk/server-side-sdks/php#installation) +### [• PHP SDK](/sdk/server-side-sdks/php/php-install) ### [• Java Local SDK](/sdk/server-side-sdks/java-local#installation) diff --git a/docs/sdk/features/track.md b/docs/sdk/features/track.md index f166d2d6..06dc4519 100644 --- a/docs/sdk/features/track.md +++ b/docs/sdk/features/track.md @@ -41,7 +41,7 @@ The Track function in the DevCycle SDKs allows you to send up custom events whic ### [• Ruby SDK](/sdk/server-side-sdks/ruby#track-events) -### [• PHP SDK](/sdk/server-side-sdks/php#track-event) +### [• PHP SDK](/sdk/server-side-sdks/php/php-usage#track-event) ### [• Java Local SDK](/sdk/server-side-sdks/java-local#track-event) diff --git a/docs/sdk/server-side-sdks/php/_category_.yml b/docs/sdk/server-side-sdks/php/_category_.yml new file mode 100644 index 00000000..bfbc4629 --- /dev/null +++ b/docs/sdk/server-side-sdks/php/_category_.yml @@ -0,0 +1,2 @@ +position: 2 +collapsed: true \ No newline at end of file diff --git a/docs/sdk/server-side-sdks/php/php-gettingstarted.md b/docs/sdk/server-side-sdks/php/php-gettingstarted.md new file mode 100644 index 00000000..296d6729 --- /dev/null +++ b/docs/sdk/server-side-sdks/php/php-gettingstarted.md @@ -0,0 +1,34 @@ +--- +title: DevCycle PHP Server SDK Getting Started +sidebar_label: Getting Started +sidebar_position: 2 +--- + + +Please follow the [installation procedure](/sdk/server-side-sdks/php/php-install) and then run the following: + +```php +setApiKey('Authorization', ''); + +$apiInstance = new DevCycle\Api\DVCClient( + $config, + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), +); +$user_data = new \DevCycle\Model\UserData(array( + "user_id"=>"my-user" +)); // \DevCycle\Model\UserData + +try { + $result = $apiInstance->allFeatures($user_data); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DVCClient->allFeatures: ', $e->getMessage(), PHP_EOL; +} + +``` \ No newline at end of file diff --git a/docs/sdk/server-side-sdks/php/php-install.md b/docs/sdk/server-side-sdks/php/php-install.md new file mode 100644 index 00000000..deb9f309 --- /dev/null +++ b/docs/sdk/server-side-sdks/php/php-install.md @@ -0,0 +1,30 @@ +--- +title: DevCycle PHP Server SDK Installation +sidebar_label: Installation +sidebar_position: 1 +--- + +Requires PHP 7.3 and later. + +## Composer Installation + +To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`: + +```json +{ + "require": { + "devcycle/php-server-sdk": "*" + } +} +``` + +Then run `composer install` + +## Manual Installation + +Download the files and include `autoload.php`: + +```php +setApiKey('Authorization', ''); - -$apiInstance = new DevCycle\Api\DVCClient( - $config, - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), -); -$user_data = new \DevCycle\Model\UserData(array( - "user_id"=>"my-user" -)); // \DevCycle\Model\UserData - -try { - $result = $apiInstance->allFeatures($user_data); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DVCClient->allFeatures: ', $e->getMessage(), PHP_EOL; -} - -``` - -## Usage - -### User Object - -The full user data must be passed into every method. The only required field is `user_id`. +The full user data must be passed into every method. The only required field is `user_id`. The rest are optional and are used by the system for user segmentation into variables and features. See the User model in the [PHP user model doc](https://github.com/DevCycleHQ/php-server-sdk/blob/main/lib/Model/UserData.php) for all accepted fields including custom fields. @@ -87,7 +18,7 @@ See the User model in the [PHP user model doc](https://github.com/DevCycleHQ/php )); // \DevCycle\Model\UserData ``` -### Get and use Variable by key +## Get and use Variable by key ```php try { $result = $apiInstance->variable($user_data, "my-key", "default"); @@ -98,7 +29,7 @@ try { ``` See [getVariableByKey](/bucketing-api/#operation/getVariableByKey) on the Bucketing API for the variable response format. -### Get all Variables +## Get all Variables ```php try { $result = $apiInstance->allVariables($user_data); @@ -109,7 +40,7 @@ try { ``` See [getVariables](/bucketing-api/#operation/getVariables) on the Bucketing API for the variable response format. -### Getting all Features +## Getting all Features ```php try { $result = $apiInstance->allFeatures($user_data); @@ -120,7 +51,7 @@ try { ``` See [getFeatures](/bucketing-api/#operation/getFeatures) on the Bucketing API for the feature response format. -### Track Event +## Track Event ```php $event_data = new \DevCycle\Model\Event(array( "type"=>"my-event" @@ -134,7 +65,7 @@ try { } ``` -### EdgeDB +## EdgeDB EdgeDB allows you to save user data to our EdgeDB storage so that you don't have to pass in all the user data every time you identify a user. Read more about [EdgeDB](/home/feature-management/edgedb/what-is-edgedb). @@ -161,8 +92,6 @@ Each method in the [Usage](#Usage) section has a corresponding asynchronous meth }); ``` - - ## Models ### UserData @@ -232,11 +161,3 @@ To run the tests, use: composer install vendor/bin/phpunit ``` - -#### About this package - -This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - -- API version: `1.0.0` -- Package version: `1.0.3` -- Build package: `org.openapitools.codegen.languages.PhpClientCodegen` diff --git a/docs/sdk/server-side-sdks/php/php.md b/docs/sdk/server-side-sdks/php/php.md new file mode 100644 index 00000000..c95268d1 --- /dev/null +++ b/docs/sdk/server-side-sdks/php/php.md @@ -0,0 +1,22 @@ +--- +title: PHP SDK +--- + +# DevCycle PHP Server SDK + +Welcome to the the DevCycle PHP SDK, initially generated via the [DevCycle Bucketing API](/bucketing-api/#tag/devcycle). + +The SDK is available as a package on Packagist. It is also open source and can be viewed on Github. + +[![Packagist](https://badgen.net/packagist/v/devcycle/php-server-sdk/latest)](https://packagist.org/packages/devcycle/php-server-sdk) +[![GitHub](https://img.shields.io/github/stars/devcyclehq/php-server-sdk.svg?style=social&label=Star&maxAge=2592000)](https://github.com/DevCycleHQ/php-server-sdk) + + + +#### About this package + +This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: `1.0.0` +- Package version: `1.0.3` +- Build package: `org.openapitools.codegen.languages.PhpClientCodegen`