From 20929a03610b7710725796f79400bfea00e3e308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Chr=C3=A1steck=C3=BD?= Date: Mon, 4 Oct 2021 22:17:49 +0200 Subject: [PATCH] docs: Update php documentation to include context provider (#1000) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update php documentation to include context provider * Update leftover from java * Remove another Java leftover Co-authored-by: Ivar Conradi Ă˜sthus --- websitev2/docs/sdks/php.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/websitev2/docs/sdks/php.md b/websitev2/docs/sdks/php.md index ab7fc94f52..54f4d45682 100644 --- a/websitev2/docs/sdks/php.md +++ b/websitev2/docs/sdks/php.md @@ -76,4 +76,26 @@ $context = new UnleashContext( $unleash->isEnabled("someToggle", $context); ``` + +**b) Via a UnleashContextProvider** + +This is a bit more advanced approach, where you configure a unleash-context provider. By doing this you do not have to rebuild or to pass the unleash-context object to every place you are calling `$unleash->isEnabled()`. + +```php +withAppName('my.php-app') + ->withInstanceId('your-instance-1') + ->withAppUrl('http://unleash.herokuapp.com/api/') + ->withContextProvider($contextProvider) + ->build(); + +// Anywhere in the code unleash will get the unleash context from your registered provider. +$unleash->isEnabled("someToggle"); +``` + > You can read more complete documentation in the [Client SDK repository](https://github.com/Unleash/unleash-client-php).