13/08
2015
Wallogit.com
2017 © Pedro Peláez
To install lifecycle-php with Composer, just add the following to your composer.json file:, (*1)
{
"require": {
"lifecycle/lifecycle" : "^0.0"
}
}
or by running the following command:, (*2)
composer require lifecycle/lifecycle
Composer installs autoloader at ./vendor/autoloader.php. to include the library in your script, add:, (*3)
require_once 'vendor/autoload.php';
If you use Symfony2, autoloader has to be detected automatically., (*4)
You can see this library on Packagist., (*5)
So you're probably wondering how to use this library for quick and easy api calls to Lifecycle. Check out this example., (*6)
TO INITIALIZE:, (*7)
lifecycle = new Lifecycle('YOUR_LIFECYCLE_API_KEY');
TO IDENTIFY:, (*8)
lifecycle::identify('$params'); //check out the example params below.
TO TRACK:, (*9)
lifecycle::track('$event_id, $unique_id');
//Example of params variable to use with identify call
$params = array( "unique_id" => "1234",
"first_name" => "Nathan",
"last_name" => "Mooney",
"email_address" => "someone@lifecycle.io",
"phone_number" => "12345678913")