瀏覽代碼

Add example for client config

Jordi Boggiano 10 年之前
父節點
當前提交
7004a9fd93
共有 1 個文件被更改,包括 10 次插入1 次删除
  1. 10 1
      README.md

+ 10 - 1
README.md

@@ -113,7 +113,16 @@ it is recommended to refer to their specific documentation or implementation for
 ### Client configuration ###
 ### Client configuration ###
 
 
 Various aspects of the client can be configured simply by passing options to the second argument of
 Various aspects of the client can be configured simply by passing options to the second argument of
-`Predis\Client::__construct()`. Options are managed using a mini DI-alike container and their values
+`Predis\Client::__construct()`.
+
+```php
+$client = new \Predis\Client(
+    ['database' => 2],
+    ['profile' => '2.8', 'prefix' => 'sample:']
+);
+```
+
+Options are managed using a mini DI-alike container and their values
 are usually lazily initialized only when needed. Predis by default supports the following options:
 are usually lazily initialized only when needed. Predis by default supports the following options:
 
 
   - `profile`: which profile to use in order to match a specific version of Redis.
   - `profile`: which profile to use in order to match a specific version of Redis.