PHP code example of userlistio / userlist
1. Go to this page and download the library: Download userlistio/userlist library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
userlistio / userlist example snippets
$userlist = new \Userlist\Push(['push_key' => '401e5c498be718c0a38b7da7f1ce5b409c56132a49246c435ee296e07bf2be39']);
$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' ]);
$relationship = [
'user' => 'user-1',
'company' => 'company-1',
'properties' => [
'role' => 'admin'
]
];
$userlist->relationships->push($relationship);
$userlist->relationship($relationship); // Alias
$userlist->relationships->create($relationship); // Alias
$user = [
'identifier' => 'user-1',
'relationships' => [
[
'company' => 'company-1',
'properties' => [
'role' => 'admin'
]
]
],
];
$userlist->users->push($user);
$company = [
'identifier' => 'company-1',
'relationships' => [
[
'user' => 'user-1',
'properties' => [
'role' => 'admin'
]
]
],
];
$userlist->companies->push($company);
$relationship = [
'user' => 'user-1',
'company' => 'company-1'
]
$userlist->relationships->delete($relationship);
$event = [
'name' => 'project_created',
'user' => 'user-1',
'properties' => [
'name' => 'Example Project',
]
];
$userlist->events->push($event);
$userlist->event($event); // Alias
$userlist->events->create($event); // Alias