laralabs/geo-sorter 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

laralabs/geo-sorter

Composer 安装命令:

composer require laralabs/geo-sorter

包简介

Postcode distance sorting package for Laravel Collections.

README 文档

README

Postcode distance sorting package for Laravel Collections.

UNITED KINGDOM POSTCODES ONLY

🚀 Quick Start

Installation

Require the package in the composer.json of your project.

composer require laralabs/geo-sorter

Publish the configuration file.

php artisan vendor:publish --tag=geosorter-config

Edit the configuration file and set your desired settings. If you want to use a custom database table name, set it here and cache your config before moving onto the next step.

Create the postcodes table by running the following command:

php artisan migrate

Once the database table has been created, run the following command to populate it with the latest UK Postcode District data.

php artisan geosorter:update

Usage

A helper function and facade are available, choose your preferred method. The sortByPostcode method accepts three arguments, the third argument being an optional $sort which can be used to override the sort order defined in the config.

Facade:

<?php
$collection = Addresses::all();
$postcode   = 'B61 XYZ';

$collection = GeoSorter::sortByPostcode($collection, $postcode, 'ASC');

Helper:

<?php
$collection = Addresses::all();
$postcode   = 'B61 XYZ';

$collection = geo_sorter()->sortByPostcode($collection, $postcode);

The above code would sort the Addresses collection in distance from the given postcode B61 XYZ.

📌 Credits

Ayeo/Geo is used to calculate the distance between coordinates.

💬 Support

Please raise an issue on GitHub if there is a problem.

🔑 License

This is open-sourced software licensed under the MIT License.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-03-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固