Skip to content

Commit 157bdec

Browse files
author
Genar Trias Ortiz
committed
Adding basic quickstart, fix #4
1 parent 3abf347 commit 157bdec

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,38 @@ For a nodejs implementation check this [link][oc-client-node]. This library is h
99

1010
## Install
1111

12-
```
12+
```bash
1313
composer require opencomponents/oc-client-php
1414
```
1515

16+
## Quickstart
17+
18+
```php
19+
use OpenComponents\Client;
20+
21+
// Initializing the client
22+
$client = new Client(array(
23+
"serverRendering" => 'https://your-components.repository.com/'
24+
));
25+
26+
// Render some component
27+
$components = $client->renderComponents(array(
28+
array(
29+
'name' => 'your-amazing-widget',
30+
'parameters' => array(
31+
'param1' => 'hello opencomponents!',
32+
'param2' => 'just show me the component'
33+
)
34+
),
35+
array(
36+
'name' => 'one-more-component'
37+
)
38+
));
39+
40+
// Print the rendered component and volià
41+
echo $components['html'];
42+
```
43+
1644
## Running tests
1745

1846
```bash

0 commit comments

Comments
 (0)