digitalcloud/laravel-postgis
Composer 安装命令:
composer require digitalcloud/laravel-postgis
包简介
关键字:
README 文档
README
This package implemented for calculate or check the distance between point and other database points.
Installation
PHP >=7.1.3 and Laravel ^5.6 are required.
the package used Laravel postgis extension to deal with postgres database points in laravel, so if need more details or how to enable postgis extension in php see previous link.
To get the latest version of Laravel PostGIS, simply require the project using Composer:
composer require digitalcloud/laravel-postgis
Usage
1 . First of all use Postgis trait in your model
<?php namespace App; use Digitalcloud\Postgis\Postgis; use Illuminate\Database\Eloquent\Model; class UserLocation extends Model { use Postgis; }
2 . By default package assume that the name of the point column is location if you want to change it override location variable on your model
protected $location = "my_column";
3 . Also By default package assume that the unit of distance is meter if you want to change it override unit variable on your model
protected $unit = "km"; //units avialble [mile, km, meter]
Functions
1. withDistance
get the distance between point and other points
UserLocation::withDistance(new Point($atitude,$longitude)) ->with("user") ->whereIn("user_id", $users) ->get();
2. whereDistance
check the distance between a point and other points in database
UserLocation::whereDistance(new Point($atitude,$longitude), ">", 50) ->with("user") ->whereIn("user_id", $users) ->get();
digitalcloud/laravel-postgis 适用场景与选型建议
digitalcloud/laravel-postgis 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.94k 次下载、GitHub Stars 达 12, 最近一次更新时间为 2018 年 10 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「geographical」 「laravel」 「models」 「postgis」 「latitude」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 digitalcloud/laravel-postgis 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 digitalcloud/laravel-postgis 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 digitalcloud/laravel-postgis 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
Geographical functionality for ORM and ODM entities and JavaScript maps rendering
Laravel 5.2 package that provides basic geographical data like Countries, Regions and Cities.
GeoNames.org geographical data and associated functionality
Alfabank REST API integration
Laravel Package from which you can store and search any cities in the world based on geonames.org data
统计信息
- 总下载量: 1.94k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 12
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-10-07