Skip to content

Commit 8ef112a

Browse files
committed
Moved readme info to docs
1 parent aee8a4c commit 8ef112a

File tree

1 file changed

+0
-140
lines changed

1 file changed

+0
-140
lines changed

README.md

Lines changed: 0 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -6,146 +6,6 @@
66
77
The SDK for PHP applications for [https://www.flagsmith.com/](https://www.flagsmith.com/).
88

9-
## Installation
10-
11-
`composer require flagsmith/flagsmith-php-client`
12-
13-
Requires PHP 7.4 or newer and ships with GuzzleHTTP.
14-
15-
You can optionally provide your own implementation of PSR-18 and PSR-16
16-
17-
> You will also need some implementation of [PSR-18](https://packagist.org/providers/psr/http-client-implementation)
18-
> and [PSR-17](https://packagist.org/providers/psr/http-factory-implementation), for example
19-
> [Guzzle](https://packagist.org/packages/guzzlehttp/guzzle)
20-
> and [PSR-16](https://packagist.org/providers/psr/simple-cache-implementation), for example
21-
> [Symfony Cache](https://packagist.org/packages/symfony/cache).
22-
> Example:
23-
24-
`composer require flagsmith/flagsmith-php-client guzzlehttp/guzzle symfony/cache`
25-
26-
or
27-
28-
`composer require flagsmith/flagsmith-php-client symfony/http-client nyholm/psr7 symfony/cache`
29-
30-
## Usage
31-
32-
The Flagsmith PHP Client is utilized in such a way that makes it immutable. Everytime you change or set a setting the client will return a clone of itself.
33-
34-
```php
35-
$flagsmith = new Flagsmith('apiToken');
36-
$flagsmithWithCache = $flagsmith->withCache(/** PSR-16 Cache Interface **/);
37-
```
38-
39-
If you are self hosting an instance of Flagsmith you can set that as the second parameter of the Flagsmith Class, make sure to include the full path
40-
41-
```php
42-
$flagsmith = new Flagsmith('apiToken', 'https://api.flagsmith.com/api/v1/');
43-
```
44-
45-
### Utilizing Cache
46-
47-
```php
48-
$flagsmith = new Flagsmith('apiToken');
49-
$flagsmithWithCache = $flagsmith
50-
->withCache(/** PSR-16 Cache Interface **/)
51-
->withTimeToLive(15); //15 seconds
52-
```
53-
54-
### Get all Flags
55-
56-
Get All feature flags. The flags will be returned as a `Flagsmith\Models\Flag` model
57-
58-
#### Globally
59-
60-
```php
61-
$flagsmith = new \Flagsmith\Flagsmith('apiToken');
62-
$flagsmith->getFlags();
63-
```
64-
65-
#### By Identity
66-
67-
```php
68-
$identity = new \Flagsmith\Models\Identity('identity');
69-
70-
$flagsmith = new \Flagsmith\Flagsmith('apiToken');
71-
$flagsmith->getFlagsByIdentity($identity);
72-
```
73-
74-
### Get Individual Flag
75-
76-
The Individual flag will be returned as a `Flagsmith\Models\Flag` model
77-
78-
#### Globally
79-
80-
```php
81-
$flagsmith = new \Flagsmith\Flagsmith('apiToken');
82-
$flagsmith->getFlag('name');
83-
```
84-
85-
#### By Identity
86-
87-
```php
88-
$identity = new \Flagsmith\Models\Identity('identity');
89-
90-
$flagsmith = new \Flagsmith\Flagsmith('apiToken');
91-
$flagsmith->getFlagByIdentity($identity, 'name');
92-
```
93-
94-
### Check if Feature is Enabled
95-
96-
Check if a feature is enabled or not
97-
98-
#### Globally
99-
100-
```php
101-
$flagsmith = new \Flagsmith\Flagsmith('apiToken');
102-
$flagsmith->isFeatureEnabled('name');
103-
```
104-
105-
#### By Identity
106-
107-
```php
108-
$identity = new \Flagsmith\Models\Identity('identity');
109-
110-
$flagsmith = new \Flagsmith\Flagsmith('apiToken');
111-
$flagsmith->isFeatureEnabledByIdentity($identity, 'name');
112-
```
113-
114-
### Get Feature Value
115-
116-
Get the value of a feature
117-
118-
#### Globally
119-
120-
```php
121-
$flagsmith = new \Flagsmith\Flagsmith('apiToken');
122-
$flagsmith->getFeatureValue('name', 'default value');
123-
```
124-
125-
#### By Identity
126-
127-
```php
128-
$identity = new \Flagsmith\Models\Identity('identity');
129-
130-
$flagsmith = new \Flagsmith\Flagsmith('apiToken');
131-
$flagsmith->getFeatureValueByIdentity($identity, 'name', 'default value');
132-
```
133-
134-
### Utilizing Identity Traits
135-
136-
You can optionally declare traits against the identity model
137-
138-
```php
139-
$identity = new \Flagsmith\Models\Identity('identity');
140-
141-
$identityTrait = (new \Flagsmith\Models\IdentityTrait('Foo'))->withValue('Bar');
142-
143-
$identity->withTrait($identityTrait);
144-
145-
$flagsmith = new \Flagsmith\Flagsmith('apiToken');
146-
$flagsmith->getFlagsByIdentity($identity);
147-
```
148-
1499
## Adding to your project
15010

15111
For full documentation visit [https://docs.flagsmith.com/clients/php/](https://docs.flagsmith.com/clients/php/)

0 commit comments

Comments
 (0)