menarasolutions/geographer-laravel

Laravel 和 Lumen 的 Geographer 集成类

0.2.1 2018-07-23 11:51 UTC

This package is auto-updated.

Last update: 2024-08-29 04:48:40 UTC


README

Geographer 的 Laravel(和 Lumen)集成

入门指南

首先安装 Laravel 集成包

$ composer require menarasolutions/geographer-laravel

好消息是 Laravel 会为您处理单例实例,因此无论您调用多少次,它都是同一个对象。

在 Laravel 5.5 中,服务提供者和别名会自动注册。如果您使用的是 Laravel 5.5,请跳过。

// Add in your config/app.php

'providers' => [
    '...',
    MenaraSolutions\Geographer\Integrations\LaravelServiceProvider::class,
];

'aliases' => [
    '...',
    'Geographer' => MenaraSolutions\Geographer\Integrations\LaravelFacade::class,
];

// Start playing with it, all the same calls
Geographer::getCountries()->useShortNames()->toArray();

完整的方法列表可在 Geographer 文档 中找到