-
Notifications
You must be signed in to change notification settings - Fork 11
First Steps (1.0)
After having configured and having a good understanding of what inputs to feed to the package, lets take a look at how to use the library to get our first profile.
First collect data following the array structure given in Dealing with input
//Create data to feed for analysis
$dataToAnalyse = [
[
"content" => "Wow, I liked @TheRock before , now I really SEE how special he is. The daughter story was IT for me. So great! #MasterClass",
"contenttype" => "text/plain",
"created" => 1447639154000,
"id" => "666073008692314113",
"language" => "en",
"sourceid" => "Twitter API",
"userid" => "@Oprah"
]
[
....
]
];
Once you have some data to analyse, resolve the service PersonalityInsights
out of the IOC container
using app('PersonalityInsights')
or app()->make('PersonalityInsights')
and pass the array of data using the addContentItems()
method.
//Create the service and pass in data
$insights = app()->make('PersonalityInsights')->addContentItems($dataToAnalyse);
Alertnatively you can use the Facade PersonalityInsights::addContentItems($dataToAnalyse);
, but keep in mind that the facade will always resolve the same PersonalityInsights object from the IOC if you have multiple profile to analyse it is best to use app()->make('PersonalityInsights')
to create different instance of the service object.