happyr / location-bundle
一个用于处理实体地理位置的Symfony2 Bundle
0.5.3
2020-11-11 10:57 UTC
Requires
- php: ^5.4 || ^7.0
- cocur/slugify: ^1.4
README
一个用于处理位置的Symfony2 Bundle。它提供了一个带有不同部分的Location对象,以便清楚地识别位置。
安装
1. 使用composer安装
php composer.phar require happyr/location-bundle
2. 启用Bundle
// app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Happyr\LocationBundle\HappyrLocationBundle(), ); }
3. 添加地理编码器
您需要在配置中指定一个地理编码器服务。地理编码器必须实现GeocoderInterface接口
happyr_location: geocoder_service: 'acme.geocoder'
使用方法
//any form public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('location', 'location', array( 'components'=>array( 'country'=>true, 'city'=>true, ) )); }