Using Composer
To install lifecycle-php with Composer, just add the following to your composer.json
file:
{
"require": {
"lifecycle/lifecycle" : "^0.0"
}
}
or by running the following command:
composer require lifecycle/lifecycle
Composer installs autoloader at ./vendor/autoloader.php
. to include the library in your script, add:
require_once 'vendor/autoload.php';
If you use Symfony2, autoloader has to be detected automatically.
You can see this library on Packagist.
So you're probably wondering how to use this library for quick and easy api calls to Lifecycle. Check out this example.
TO INITIALIZE:
lifecycle = new Lifecycle('YOUR_LIFECYCLE_API_KEY');
TO IDENTIFY:
lifecycle::identify('$params'); //check out the example params below.
TO TRACK:
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")