Skip to content

Commit

Permalink
Merge pull request #69 from roberto-butti/master
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
joaokamun authored Dec 15, 2022
2 parents 7805963 + b16d394 commit 15efebc
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ In this README file you will find information for using the Storyblok PHP client

## Installing the Storyblok PHP client
You can install the Storyblok PHP Client via composer.
Storyblok's PHP client requires PHP version 7.3 to 8.2.
The suggestion is to use an actively supported version of PHP (8.1 and 8.2).

If you want to install the _stable_ release of Storyblok PHP client you can launch:
```bash
Expand Down Expand Up @@ -337,6 +339,17 @@ $result = $client->getStories();
print_r($result);
```

The caching mechanism uses under the hood the Symfony Cache package.
So, you can use the Adapter supported the Symfony Cache.
For example, for using a MySql database as cache storage, you can setup the connection via the PHP PDO class:
```php
$client = new \Storyblok\Client('your-storyblok-private-token');
$pdo = new PDO('mysql:host=127.0.0.1;dbname=db_php-client;charset=utf8mb4;', "root");
$client->setCache('mysql', ['pdo' => $pdo]);
$result = $client->getStories();
print_r($result);
```

### Clearing the cache (Optionally if using setCache)

In order to flush the cache when the user clicks publish, you need to listen to the published event in javascript or define a webhook in the space settings that clears the cache on your server.
Expand Down

0 comments on commit 15efebc

Please sign in to comment.