daavelar/laravel-geocode
最新稳定版本:1.0.1
Composer 安装命令:
composer require daavelar/laravel-geocode
包简介
This is a Laravel package that provides functionalities for geocoding addresses using OpenCage API
README 文档
README
Description
This is a Laravel wrapper for leveraging the functionalities of geocoding APIs. It simplifies the process of integrating geocoding services into your Laravel applications.
Features
- Easy integration with Laravel
- Supports multiple geocoding services
- Simplified API for geolocation tasks
Installation
Use composer to install this package:
composer require daavelar/laravel-geocode
Configuration
After the package has been installed, you will need to register it in the providers array in your config/app.php
file.
'providers' => [ // Other service providers... Daavelar\LaravelGeocode\LaravelGeoCodeServiceProvider::class, ],
You should also publish the config file with the following artisan command:
php artisan vendor:publish --provider="Daavelar\LaravelGeocode\LaravelGeoCodeServiceProvider"
This command will publish a geocode.php config file to your config directory. If you open this file, you will see
all the available settings you can adjust for this package.
Usage To use the geocoding functionality, you can use the GeoCodeFacade provided by the package. Here is an example of how to use it:
<?php use Daavelar\LaravelGeoCode\GeoCodeFacade as GeoCode; $address = '1600 Amphitheatre Parkway, Mountain View, CA'; $result = GeoCode::fromAddress($address); print_r($result);
Make sure to set your OpenCage API key in the config/geocode.php file:
<?php return [ 'driver' => 'opencage', 'opencage' => [ 'api_key' => env('OPENCAGE_API_KEY'), ], ];
You can set the OPENCAGE_API_KEY in your .env file:
OPENCAGE_API_KEY=your_api_key_here
统计信息
- 总下载量: 31
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2024-07-15