bluemove / phpgmaps
该包的最新版本(dev-master)没有可用的许可证信息。
Bluemove 是从 appitventures/phpgmaps 分支出来的
dev-master / 1.0.x-dev
2016-02-03 11:45 UTC
Requires
- php: >=5.4.0
- illuminate/support: 4.2.*
This package is not auto-updated.
Last update: 2024-09-14 18:52:51 UTC
README
A none CI implementation of BIOINSTALL's CodeIgniter library.
我在使用 CodeIgniter 的时候发现这个库非常有用。然而,为了让它在 Laravel 项目中使用,我需要做一些工作。对于类中的“重活”,我并不敢居功。
#安装
将此包添加到您的 composer.json
并更新 composer。
对于 Laravel 4.*,请使用以下行。请注意,我只有时间支持 Laravel 的最新稳定版本。因此,任何未来的更新(功能、安全或其他)都不会应用于 Laravel 4 兼容分支。
"bluemove/phpgmaps": "dev-master"
更新 composer 后,将 ServiceProvider 添加到 app/config/app.php
中的 providers 数组。
'bluemove\Phpgmaps\PhpgmapsServiceProvider',
以及 Facade
'Gmaps' => 'bluemove\Phpgmaps\Facades\Phpgmaps',
示例
以下代码将提示用户获取他们的地理位置,然后创建一个以他们的 lat/lng 为中心的地图。
Route::get('/', function(){
$config = array();
$config['center'] = 'auto';
$config['onboundschanged'] = 'if (!centreGot) {
var mapCentre = map.getCenter();
marker_0.setOptions({
position: new google.maps.LatLng(mapCentre.lat(), mapCentre.lng())
});
}
centreGot = true;';
Gmaps::initialize($config);
// set up the marker ready for positioning
// once we know the users location
$marker = array();
Gmaps::add_marker($marker);
$map = Gmaps::create_map();
echo "<html><head><script type="text/javascript">var centreGot = false;</script>".$map['js']."</head><body>".$map['html']."</body></html>";
});