2gis/api-client
PHP-клиент для API 2ГИС: регионы, справочник/каталог, транспорт и геоданные. Установка через Composer, простой вызов методов API 2.0 и работа с ответами сервиса. Лицензия MIT.
curl usage, lack of type hints).app['2gis']).config/2gis.php for API keys, endpoints, and rate limits.2gis()->regions()->get()).rector or manual fixes for array() → [], foreach changes, or curl deprecations.curl/file_get_contents may need replacement with Guzzle for modern Laravel apps.| Risk | Impact | Mitigation |
|---|---|---|
| PHP 8.x Incompatibility | High | Run rector or php-compat to auto-fix deprecated syntax. |
| 2GIS API v2.0 Deprecation | Critical | Monitor 2GIS’s API changelog and fork if needed. |
| No Rate Limit Handling | Medium | Implement Laravel middleware or queue-based retries (e.g., spatie/queueable). |
| Transport/Geo API Instability | High | Use only stable endpoints (regions/catalog) or build custom wrappers. |
| Dependency Vulnerabilities | Low | Audit with composer audit; pin versions in composer.json. |
phpstan/rector to estimate fixes (e.g., array() → [], foreach changes).Laravel Ecosystem:
// app/Providers/2gisServiceProvider.php
public function register()
{
$this->app->singleton('2gis', function ($app) {
return new \TwoGis\Client(config('2gis.key'));
});
}
config/2gis.php.
return [
'key' => env('TWOGIS_API_KEY'),
'endpoints' => [
'regions' => 'https://api.2gis.com/2.0/regions',
'catalog' => 'https://api.2gis.com/2.0/catalog',
],
'rate_limit' => 1000, // requests/hour
];
2gis() helper (e.g., via laravel-shift/blueprint).Point objects).PHP Version:
rector to upgrade deprecated PHP features (e.g., array() → []).PHP 8.1+ and Laravel 9/10 via phpunit + pest."2gis/api-client": "dev-master").spatie/laravel-rate-limiter).curl with Guzzle if needed.Region, Business).laravel-health).composer platform-check to flag issues.curl, json, and mbstring are enabled (required by 2GIS API).busy:handle).composer audit for security advisories.spatie/backoff) or queue-based retries.laravel-redis) or database (e.g., laravel-cache).busy:handle).| Failure | Impact
How can I help you explore Laravel packages today?