定制 plutuss/laravel-geonames-api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

plutuss/laravel-geonames-api

最新稳定版本:0.1.3

Composer 安装命令:

composer require plutuss/laravel-geonames-api

包简介

The Laravel Geonames API package provides an easy way to integrate the Geonames API into your Laravel application. This package enables developers to effortlessly interact with the Geonames API to retrieve geographic data such as cities, countries, coordinates, time zones, and other location-based i

README 文档

README

Laravel:

Note

The Laravel Geonames API package provides an easy way to integrate the Geonames API into your Laravel application. This package enables developers to effortlessly interact with the Geonames API to retrieve geographic data such as cities, countries, coordinates, time zones, and other location-based information.

  • Key Features
  1. Geonames API Requests: Simple method to send requests and handle responses from the Geonames API.
  2. Support for Various Query Types: Supports all major query types including name searches, reverse geocoding, and more.
  3. Configuration: Easy setup of API credentials and other parameters through a configuration file.
  4. Laravel Compatibility: Full integration with the Laravel ecosystem, including support for Service Providers and Facades.
 composer require plutuss/geo-names-laravel
php artisan vendor:publish --provider="Plutuss\GeoNames\Providers\GeoNamesServiceProvider"
#  .env
GEO_NAMES_USERNAME=user_name

Use Facade GeoName

        $response = GeoName::postalCodeSearchJSONFromName('city_name');

        $response = GeoName::setPostalCode(6600)
            ->setCountryCode('CH')
            ->postalCodeSearchJSONFromName('city_name');
            
          // OR
      
        $response = GeoName::setOption([
            'country' => 'CH',
        ])->postalCodeSearchJSONFromName('city_name');
        $response = GeoName::postalCodeSearchJSONFromPostCode(6600);

        $response = GeoName::setCountryCode('CH')
            ->postalCodeSearchJSONFromPostCode(6600);
            
          // OR

        $response = GeoName::setOption([
            'country' => 'CH',
        ])->postalCodeSearchJSONFromPostCode('6600');
     setCountryCode(string $countryCode): static;
    
     setPostalCode(int $value): static;

     setPostalCodeStartsWith(string $value): static;
 
     setPlaceName(string $value): static;

     setPlaceNameStartsWith(string $value): static;

     setCountry(string $value): static;

     setCountryBias(string $value): static;

     setMaxRows(int $value): static;
  
     setStyle(string $value): static;

     setOperator(string $value): static;

     setCharset(string $value): static;

     setIsReduced(bool $value): static;
   
     setEast(float $value): static;
   
     setWest(float $value): static;

     setNorth(float $value): static;

     setSouth(float $value): static;
 
     setLatitude(string $value): static;

     setLongitude(string $value): static;
 
     setRadius(int $value): static;
     setOption(array $params): static;
     searchJSON(string $country): JsonResponse|array|Collection;

     postalCodeSearchJSONFromPostCode(int $postalCode, int $radius = 5, int $maxRows = 10): JsonResponse|array|Collection;

     postalCodeSearchJSONFromName(string $name, int $radius = 5, int $maxRows = 10): JsonResponse|array|Collection;

     findNearbyPostalCodes(int $lat, int $lng): JsonResponse|array|Collection;

     postalCodeCountryInfo(): JsonResponse|array|Collection;

     findNearbyJSON(int $lat, int $lng): JsonResponse|array|Collection;

Response

     latitude(): mixed;

     getCollectionData(): Collection;

     getArrayData(): array;

     longitude(): mixed;

     placeName(): mixed;

     postalCode(): mixed;

     countryCode(): mixed;

     region(): mixed;

     land(): mixed;

    // The getNestedValue() method retrieves a value
    // from a deeply nested array using "dot" notation
    // $response->getNestedValue('key.array')
     getNestedValue($path, $default = null): mixed;

统计信息

  • 总下载量: 86
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固