sfYahooBossPlugin - 0.1.2

James Charlesworth

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to the Plugins Home


Forgot your password?
Create an account



advanced search
Information Readme Releases Changelog Contribute
Show source


The sfYahooBossPlugin allows you to easily integrate web search into your Symfony project.


  • Easily add search functionality to your project
  • Set the search results to a single site
  • Includes Delicious saves, tags, Searchmonkey data


The sfYahooBossPlugin is licensed under the MIT License.


  • Install the plugin

    $ symfony plugin:install sfYahooBossPlugin
    $ symfony cc
  • Be sure that the plugin is activated in config/ProjectConfiguration.class.php

  • Customize your stylesheet to match your site

Add you Yahoo Boss API

You can eiter set your key each time you instatiate the YahooBoss object: [php] $YahooBoss = new YahoooBoss('API_KEY');

Even better, set the api key in your app.yml file: [plain] all: yahooboss_api_key: your_api_key

Action configuration

Update your action to show the search form and results.

Create the form:

// apps/[APP_NAME]/modules/[MODULE_NAME]/actions/actions.class.php
class MyActionActions extends sfActions
   * Executes index action
   * @param sfRequest $request A request object
  public function executeIndex(sfWebRequest $request)
    $this->form = new YahooBossForm();
    //call the new search action

Next, create the processsSearch action:

 protected function processSearch(sfWebRequest $request, sfForm $form)

    if (!$request->getParameter('search'))
        $this->boss = array('results'=>null);

        $this->csrf_token = null;


    $this->form = new YahooBossForm();
    $this->form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));

    if ($this->form->isValid())

        $search = new YahooBoss();
        //see http://developer.yahoo.com/search/boss/boss_guide/News_Search.html
        //for date ranges
        // $search->setAge('100d');

        //see http://developer.yahoo.com/search/boss/boss_guide/Web_Search.html#optional_args_web
        // for view args
        $view = '';//delicious_saves,delicious_toptags,keyterms,searchmonkey_feed

        $search->setCount(10); //number of results per page

        $search_query = $request->getParameter('search');
        $this->query = $search_query['q'];

        //the search query

        //limit results to one site
        // $search->setSite('seoatl.com');

        // $search->setOrderByDate();

        } else {
            $this->start = $search_query['start'];
        $search->setStart($this->start); //important for pagination

        $this->boss = $search->execute();
        $this->csrf_token = $search_query['_csrf_token'];//need to pass csrf token if enabled



2010-08-09 | 0.1.0-beta

  • First beta release