dev-feat/camelCase
dev-feat/camelCaseA bundle to interact with symfony and recombee API
MIT
The Requires
dev-master
9999999-devA bundle to interact with symfony and recombee API
MIT
The Requires
A bundle to interact with symfony and recombee API
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*1)
$ composer require "obtao/recombeebundle:dev-master"
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*2)
Then, enable the bundle by adding it to the list of registered bundles,
in the app/AppKernel.php
file of your project:, (*3)
This bundle rely on JMS serializer as dependency, so if you are not using it yet, you have to add it too., (*4)
<?php // app/AppKernel.php // ... class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new \Obtao\RecombeeBundle\ObtaoRecombeeBundle(), new \JMS\SerializerBundle\JMSSerializerBundle() // only if you are not using it yet ); // ... } // ... }
// app/config.yml obtao_recombee: recombee_database_name: "your-database-name" recombee_secret_token: "your-api-key"
Below example of usage in symfony controller to create a user and related properties., (*5)
Bundle provide 2 custom model (for user and item), feel free to modify according your needs., (*6)
BatchBuilder helper will extract all properties of such item to guess the best type for recombee API (need to implements HasSkuInterface), (*7)
<?php namespace AppBundle\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use \Obtao\RecombeeBundle as ObtaoRecombee; class DefaultController extends Controller { /** * @Route("/", name="homepage") */ public function indexAction() { // service to reach API $apiCaller = $this->get('obtao.recombee.api.caller'); // Helper to build batch of properties $batchBuilder = $this->get('obtao.recombee.batch.builder'); // reset database first (be careful !) : expected response "ok" $reset = var_dump($apiCaller->sendToApi(new ObtaoRecombee\Model\ResetDatase())); // create a new User $user = new ObtaoRecombee\Model\User(); $user->setSku(12345); $user->setNickName('JohnDoe'); $user->setOriginCountry('FR'); // use batch helper to build all properties for user above /** @var Batch $batch */ $batch = $batchBuilder->buildBatchOfProperties($user, ObtaoRecombee\Model\AddUserProperty::class); // send batch of properties to API : expected response batch of "ok" var_dump($apiCaller->sendToApi($batch)); // create user : expected response "ok" var_dump($apiCaller->sendToApi(new ObtaoRecombee\Model\SetUserValues($user))); die('that\'s all folks'); } }
A bundle to interact with symfony and recombee API
MIT
A bundle to interact with symfony and recombee API
MIT