sfGeoNamesPlugin - 1.0.2

Widget using GeoNames API.

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


Widget using GeoNames API - sfGeoNamesPlugin #


The aim of sfGeoNamesPlugin is to provide widget using the GeoNames API.

Currently this plugin provides a single widget to an autocomplete city text field based on another field containing the postal code.


  • Install the plugin
$ symfony plugin:install sfGeoNamesPlugin
  • Publish assets
 $ symfony plugin:publish-assets
  • Clear the cache
 $ symfony cache:clear


In your form set desired field to use sfWidgetFormGeoNamesCityAutoComplete. There is a require option : postal_code_field. This option should containt name of the input postal code field.

    class TestForm extends sfForm
      public function configure()
          'my_city_field' => new sfWidgetFormGeoNamesCityAutoComplete(
              'postal_code_field' => 'my_postal_code_field',

This is enough for the widget to work but you can add additionnary option.

Available Options:

  • postal_code_field: Name of the input field used for postal code. (required)
  • suggest_field: ID of the element receiving suggestion. if this option isn't set the plugin will automaticaly create a suggest box under the city input widget. otherwise specified ID will be used for rendering suggestion.
  • country_code: The country code like defined in http://www.geonames.org/countries/. Default value is US.

Contribution & Bugs

If you'd like to contribute or found any bugs, you are welcome to report them.