Warning:
You are viewing the Feeds v2 documentation. Feeds v2 is in maintenance mode and no longer receives new features. New projects should use Feeds v3, a major upgrade in performance, capabilities, and developer experience. To move an existing app, follow the migration guide.

Users

Stream allows you to store user information and embed them inside activities or use them for personalization. When stored in activities, users are automatically enriched by Stream.

// The PHP API client exposes users methods on $client->users()
// when adding reactions, collections or reading feeds with enrichment
// you can provide `$user_id` as argument

Adding Users

This endpoint allows you to insert a new user.

Name Type Description
id string The unique identifier for the new user (eg. username, user id, etc.). The value is restricted to alphanumeric characters, dashes and underscore symbols.
data object The data related to the user.
// create a new user with the name in userdata
$user = $client->users()->add('42', array('name' => 'Arthur Dent'));
// get OR create the user
$user = $client->users()->add('42', array('name' => 'Arthur Dent'), true);
Info:

The size of a user object can not exceed 10kB

Retrieving Users

The retrieving users endpoint allows you to retrieve a user by their ID.

$client->users()->get('42');

Removing Users

The delete endpoint removes a user by their ID.

$client->users()->delete('42');
Info:

When you delete a user it will be converted to a missing reference and throw an error when enriching.

Updating Users

This endpoint allows you to update a user by their ID.

Parameters

name type description default optional
id string The ID of the user to update -
data object The data related to the user -
$user = $client->users()->update('42', array('name' => 'Arthur Dent');
Add Chat to my app: getstream.io/SKILL.md

The fastest way to build with Stream. Start a new project or improve an existing one. Full CLI and documentation integration out of the box.


Ask your agent:

/stream Build me a Social App with Feeds and Moderation.
/stream Any livestream calls running?
/stream Feeds PHP v2: <Your Question>