Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion website/docs/api-clients/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import TabItem from '@theme/TabItem';
groupId="language"
defaultValue="js"
values={[
{ label: 'JavaScript', value: 'js', }
{ label: 'JavaScript', value: 'js', },
{ label: 'PHP', value: 'php', }
]
}>
<TabItem value="js">
Expand Down Expand Up @@ -111,5 +112,41 @@ const res = await personalizationClient.getUserTokenProfile({
console.log('[Results]', res);
```

</TabItem>

<TabItem value="php">

## Installation

First, install Algolia PHP API Client via the composer package manager:
```bash
composer require algolia/algoliasearch-client-php
```
## Using the client

Then, create objects on your index:
```php
$client = Algolia\AlgoliaSearch\Api\SearchClient::create(
'<YOUR_APP_ID>',
'<YOUR_API_KEY>'
);

$client->saveObject('<YOUR_INDEX>', ['objectID' => 1, 'name' => 'Foo']);
```

Finally, you may begin searching an object using the `search` method:
```php
$objects = $client->search('<YOUR_INDEX>', ['query' => 'Foo']);
```

Another example with the personalization client:
```php
$client = Algolia\AlgoliaSearch\Api\PersonalizationClient::create(
'<YOUR_APP_ID>',
'<YOUR_API_KEY>'
);

$res = $client->getUserTokenProfile('<YOUR_TOKEN>');
```
</TabItem>
</Tabs>