This library helps with integrating Userlist into PHP applications.
This library can be installed via Composer:
composer require userlist/userlist dev-master
The only required configuration is the Push API key. You can get your Push API key via the Push API settings in your Userlist account.
Configuration values can be set when creating a new push client or via environment variables. The environment takes precedence over values provided during the initialization process.
Configuration via environment variables
USERLIST_PUSH_KEY=401e5c498be718c0a38b7da7f1ce5b409c56132a49246c435ee296e07bf2be39
Configuration during initialization
$userlist = new \Userlist\Push(['push_key' => '401e5c498be718c0a38b7da7f1ce5b409c56132a49246c435ee296e07bf2be39']);
Before tracking user or event data, create a new push client. If you configured your push key via environment variables there's nothing to add. Otherwise, see the example above.
$userlist = new \Userlist\Push();
$user = [
'identifier' => 'user-1',
'email' => '[email protected]',
'properties' => [
'first_name' => 'Jane',
'last_name' => 'Doe'
]
];
$userlist->users->push($user);
$userlist->user($user); // Alias
$userlist->users->create($user); // Alias
$userlist->users->delete('user-1');
$userlist->users->delete($user);
$company = [
'identifier' => 'company-1',
'name' => 'Example, Inc.',
'properties' => [
'industry' => 'Software Testing'
]
];
$userlist->companies->push($company);
$userlist->company($company); // Alias
$userlist->companies->create($company); // Alias
$userlist->companies->delete('company-1');
$userlist->companies->delete([ 'identifier' => 'company-1' ]);
$event = [
'name' => 'project_created',
'user' => 'user-1',
'properties' => [
'name' => 'Example Project',
]
];
$userlist->events->push($event);
$userlist->event($event); // Alias
$userlist->events->create($event); // Alias
Bug reports and pull requests are welcome on GitHub at https://github.com/userlist/userlist-php. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The library is available as open source under the terms of the MIT License.
Everyone interacting in the Userlist project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
Userlist allows you to onboard and engage your SaaS users with targeted behavior-based campaigns using email or in-app messages.
Userlist was started in 2017 as an alternative to bulky enterprise messaging tools. We believe that running SaaS products should be more enjoyable. Learn more about us.