Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Breinify API PHP Library

Breinify's DigitalDNA API puts dynamic behavior-based, people-driven data right at your fingertips.

Step By Step Introduction

What is Breinify's DigitialDNA

Breinify's DigitalDNA API puts dynamic behavior-based, people-driven data right at your fingertips. We believe that in many situations, a critical component of a great user experience is personalization. With all the data available on the web it should be easy to provide a unique experience to every visitor, and yet, sometimes you may find yourself wondering why it is so difficult.

Thanks to Breinify's DigitalDNA you are now able to adapt your online presence to your visitors needs and provide a unique experience. Let's walk step-by-step through a simple example.

Quick start

Step1: Configure the library

In order to use the library you need a valid API-key, which you can get for free at In this example, we assume you have the following api-key:


// configure the library
$apiKey = "772A-47D7-93A3-4EA9-9D73-85B9-479B-16C6";
$breinify = new \Breinify\API\Breinify($apiKey);

The Breinify object is now configured with a valid configuration.

Step 2: Start using the library

Placing activity triggers

The engine powering the DigitalDNA API provides two endpoints. The first endpoint is used to inform the engine about the activities performed by visitors of your site. The activities are used to understand the user's current interest and infer the intent. It becomes more and more accurate across different users and verticals as more activities are collected. It should be noted, that any personal information is not stored within the engine, thus each individual's privacy is well protected. The engine understands several different activities performed by a user, e.g., landing, login, search, item selection, or logout.

// create a user 
$user = new \Breinify\API\BreinUser();

// create an activity
$activity = new \Breinify\API\BreinActivity();

// send a request

That's it!

Placing temporalData triggers

Temporal Intelligence API provides temporal triggers and visualizes patterns enabling you to predict a visitor’s dynamic activities. Currently this will cover:

  • Current Weather
  • Upcoming Holidays
  • Time Zone
  • Regional Events

They can be requested like this:

// create a user 
$user = new \Breinify\API\BreinUser();
$user->setLocalDateTime("Sun Dec 25 2016 18:15:48 GMT-0800 (PST)");

// create temporalData object and invoke the request
$temporalData = new \Breinify\API\BreinTemporalData();
$result = $breinify->temporalData($temporalData);

A more detailed introduction


This library is used to integrate the Brein Engine (more specific, the API's end-points: activity and lookup) into a given PHP based web-platform. The library requires PHP 5 or higher.

Communicating with the Brein Engine

The communication with the Brein Engine can be performed from back-end side, i.e.,:

In addition, the communication can also be performed through injected JavaScript on client-side.

In the former case, it is necessary that the PHP back-end infrastructure allows the communication with the Brein Engine (i.e., outgoing POST-traffic should not be blocked). In the latter case, the communication with the Brein Engine might be blocked by the client. Thus, we recommend the usage of a back-end to back-end communication based on file-streams or cURL.


Using back-end calls utilizing file-streams

If the communication between the back-end and the Brein Engine is performed with file-streams the back-end must fulfill the following requirements:

Using back-end calls utilizing cURL

If the communication between the back-end and the Brein Engine is performed using cURL the back-end must fulfill the following requirements:

  • POST calls to the Brein Engine must not be blocked by the firewall (i.e., outgoing traffic should be possible), and
  • the cURL module must be available, i.e., the functions curl_init, curl_setopt, curl_exec, curl_getinfo, and curl_close must be available.

IDE Configuration

Further information regarding the configuration of the IDE can be found here.