You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,19 @@
9
9
10
10
The SDK for PHP applications for [https://www.flagsmith.com/](https://www.flagsmith.com/).
11
11
12
+
## Requirements
13
+
14
+
The Flagsmith PHP SDK requires the following PHP extensions to be enabled. These are essentials for the library to function properly.
15
+
16
+
- bc-math
17
+
- gmp
18
+
19
+
Please view the documentation here to install the extensions, if you haven't already. For [BC-Math](https://www.php.net/manual/en/bc.installation.php) and [GMP](https://www.php.net/manual/en/gmp.installation.php). To enable for docker containers, please have a look at our sample in the example directory.
20
+
21
+
## Local Evaluation
22
+
23
+
Since PHP requests are separate, there is little benefit to use local evaluation without caching. To enable local evaluation, please set the environmentTtl value (>0) and using PSR simple cache implementation.
24
+
12
25
## Adding to your project
13
26
14
27
For full documentation visit [https://docs.flagsmith.com/clients/php/](https://docs.flagsmith.com/clients/php/)
// Cache the environment call to reduce network calls for each and every evaluation.
59
+
// This will load the environment from cache (or API, if cache does not exist.)
60
+
$flagsmith->updateEnvironment();
61
+
```
62
+
63
+
An optional cron job can be added to refresh this cache at a set time depending on your choice. Please set EnvironmentTTL value for this purpose.
64
+
65
+
```php
66
+
// the environment will be cached for 100 seconds.
67
+
$flagsmith = $flagsmith->withEnvironmentTtl(100);
68
+
$flagsmith->updateEnvironment();
69
+
```
70
+
71
+
```sh
72
+
*** 1 40 php index.php # using cli
73
+
*** 1 40 curl http://localhost:8000/ # using http
74
+
```
75
+
76
+
Note:
77
+
- Please note that for the environment cache, please use the server key generated from the Flagsmith Settings menu. The key's prefix is `ser.`.
78
+
- The cache is important for concurrent requests. Without cache, each request in PHP is a different process with its own memory objects. The cache (filesystem or other) would enforce that the network call is reduced to a file system one.
79
+
30
80
## Troubleshooting
31
81
If you see dependency related issues. Try backing up and removing your composer.lock file and then running composer install
0 commit comments