1. Go to this page and download the library: Download it/search-bundle 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/ */
it / search-bundle example snippets
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new IT\SearchBundle\ITSearchBundle(),
// ...
);
}
// ACMEBundle\EventSubscriber\SearchEventSubscriber.php
use IT\SearchBundle\Event\ITSearchEvents;
use IT\SearchBundle\Event\SearchPostIndexEvent;
use IT\SearchBundle\Event\SearchPreIndexEvent;
use IT\SearchBundle\Event\SearchPreIndexObjectEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class SearchEventSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
return array(
ITSearchEvents::PRE_INDEX => 'preIndex',
ITSearchEvents::PRE_INDEX_OBJECT => 'preIndexObject',
ITSearchEvents::POST_INDEX => 'postIndex',
);
}
public function preIndex(SearchPreIndexEvent $evt)
{
// Do stuff here
}
public function preIndexObject(SearchPreIndexObjectEvent $evt)
{
// Do stuff here
}
public function postIndex(SearchPostIndexEvent $evt)
{
// Do stuff here
}
}