Recommendations API for PHP

Recommend API for PHP

Recommend & Insights APIs and UI Library for PHP

Sign up

Features

  • Fully integrated into Algolia’s Analytics and Insights API

  • Finds items Frequently Bought Together and Related Products

  • Applies to ecommerce, media, back office, and any other domain

  • Leverages your data and user interactions / analytics to create ML models

  • Comes with filtering and control over confidence thresholds   

  • Compatible with Algolia’s Search APIs and InstantSearch

  • Comes with a front end library

Version

  • Supports all modern PHP versions (7.2+)

Related Integrations

  • InstantSearch for React, Vue, Angular, vanilla 
  • Search APIs

Get started

  • Send Events using Insights
    1
    $insights = Algolia\AlgoliaSearch\InsightsClient::create('YourApplicationID''YourSearchOnlyAPIKey');
    2
    3
    // send click events
    4
    $insights->user("userToken")->clickedObjectIDs(
    5
      'your_event_name',
    6
      'your_index_name',
    7
      ['objectID1', 'objectID2']
    8
    );
    9
    // send conversion events
    10
    $insights->user("user-1")->convertedObjectIDs(
    11
      'your_event_name',
    12
      'your_index_name',
    13
      ['objectID1', 'objectID2']
    14
    );
  • Get Recommendations - API
    1
    $recommendations = $recommendClient->getRelatedProducts([
    2
      [
    3
        'indexName' => 'your_index_name',
    4
        'objectID' => 'your_object_id',
    5
      ],
    6
    ]);
  • Display Recommendations - Front End
    1
    <!--HTML-->
    2
    <div class="relatedProducts"></div>
    3
    4
    // JavaScript
    5
    function RelatedItem({ item }) {
    6
      return (
    7
        <a href={item.url}>
    8
          <img src={item.image_link} alt={item.name} />
    9
          <div>{item.category}</div>
    10
          <div>{item.name}</div>
    11
          <div>${item.price}</div>
    12
        </a>
    13
      );
    14
    }
    15
    16
    relatedProducts({
    17
      container: '#relatedProducts',
    18
      recommendClient,
    19
      indexName,
    20
      objectIDs: [currentObjectID],
    21
      itemComponent: RelatedItem,
    22
    });
Get started for free
Explore developer docs