composer require getstream/stream-php
Activity Feeds V3 is in closed alpha — do not use it in production (just yet).
Installation
Composer
GitHub repository: https://github.com/GetStream/getstream-php. Feel free to submit bug reports and feature requests.
The package is tested against these environments:
- PHP 7.4+
- PHP 8.0+
- PHP 8.1+
- PHP 8.2+
- PHP 8.3+
To create a client, you’ll need your API key and secret. Both of them can be found in your Stream Dashboard.
You can optionally pass a timeout for the API requests, the default timeout is 6000ms.
<?php
require_once 'vendor/autoload.php';
use GetStream\Stream\Client;
// Create client with default timeout (6000ms)
$client = new Client('api_key', 'api_secret');
// Or create client with custom timeout (3 seconds)
$client = new Client('api_key', 'api_secret', null, null, 3.0);
// Get the feeds client
$feedsClient = $client->feeds();
// Your feeds operations here...
?>
Alternative initialization
You can also initialize the client using different configuration options:
<?php
require_once 'vendor/autoload.php';
use GetStream\Stream\Client;
$this->client = (new ClientBuilder())
->apiKey($this->apiKey)
->apiSecret($this->apiSecret)
->build();
$this->feedsV3Client = (new ClientBuilder())
->apiKey($this->apiKey)
->apiSecret($this->apiSecret)
->buildFeedsClient();