PHP code example of predictator / co-visitation-counts

1. Go to this page and download the library: Download predictator/co-visitation-counts 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/ */

    

predictator / co-visitation-counts example snippets


$coVisit = new CoVisitationCounts();

$visitedObject = new CoVisitationCounts\VisitedObject('10');
$visit = new CoVisitationCounts\Visit('userId-12', $visitedObject);

$coVisit->addVisit($visit);

$currentVisitedObject = new CoVisitationCounts\VisitedObject('11');
$currentVisit = new CoVisitationCounts\Visit('userId-16', $currentVisitedObject, new \DateTime());

$result = $coVisit->getResult($currentVisit);


$model = $coVisit->exportModel(new CoVisitationCounts\CoVisitationCountsModel());
$result = $model->getResult($currentVisit);


/** @var VisitedObjectInterface $item */
foreach ($result as $item) {
    $item->getId(); 
}