bulton-fr/nmea-parser 问题修复 & 功能扩展

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

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

bulton-fr/nmea-parser

Composer 安装命令:

composer require bulton-fr/nmea-parser

包简介

NMEA PHP parser

关键字:

README 文档

README

Build Status Code Coverage Scrutinizer Code Quality

Latest Stable Version Latest Unstable Version License

Read a NMEA line, detect the frame type and parse the line to obtain all datas.

Supported frame type :

  • GGA
  • GLL
  • GSA
  • GSV
  • RMC
  • VTG

Install it

Use composer

Add into composer.json file :

{
    "require": {
        "bulton-fr/nmea-parser": "master",
    }
}

Use it

<?php

//Require composer autoload
require_once(__DIR__.'/vendor/autoload.php');

//Instanciate the parser
$parser = new BultonFr\NMEA\Parser;

//Déclare a line to parse
$line = '$GPGGA,064036.289,4836.5375,N,00740.9373,E,1,04,3.2,200.2,M,,,,0000*0E';

//Parse the line
$frame = $parser->readLine($line);

$frame contains all datas about the readed line. If you var_dump($frame) :

class BultonFr\NMEA\Frames\GGA#2 (19) {
  protected $frameType => string(3) "GGA"
  protected $frameRegex => string(175) "/^([A-Z]{2}[A-Z]{3}),(\d{6}\.\d{2,3}),([0-9\.]+),(N|S),([0-9\.]+),(E|W),(\d{0,1}),(\d{0,2}),([0-9\.]*),([0-9\.]*),([A-Z]{0,1}),([0-9\.-]*),([A-Z]{0,1}),([0-9\.]*),(\d{0,4})$/m"
  protected $utcTime => class DateTime#5 (3) {
    public $date => string(26) "2017-09-29 06:40:36.289000"
    public $timezone_type => int(3)
    public $timezone => string(3) "UTC"
  }
  protected $latitude => string(9) "4836.5375"
  protected $latitudeDirection => string(1) "N"
  protected $longitude => string(10) "00740.9373"
  protected $longitudeDirection => string(1) "E"
  protected $gpsQuality => int(1)
  protected $nbSatellites => int(4)
  protected $horizontalDilutionPrecision => double(3.2)
  protected $altitude => double(200.2)
  protected $altitudeUnit => string(1) "M"
  protected $geoidalSeparation => double(0)
  protected $geoidalSeparationUnit => string(0) ""
  protected $ageGpsData => double(0)
  protected $differentialRefStationId => int(0)
  protected $line => string(70) "$GPGGA,064036.289,4836.5375,N,00740.9373,E,1,04,3.2,200.2,M,,,,0000*0E"
  protected $message => string(66) "GPGGA,064036.289,4836.5375,N,00740.9373,E,1,04,3.2,200.2,M,,,,0000"
  protected $checksum => string(2) "0E"
}

There is a getter for all properties, except for frameRegex, message and checksum.

Add a new frame type

Add a new class into the namespace BultonFr\NMEA\Frames. Else, you need to extends Parser class and redefine the method obtainFrameParser.

The name of the class need to be the frame type name. Example GGA for frame type GGA. This class should extends the class \BultonFr\NMEA\Frame.

You should have properties $frameType and $frameRegex. And the method decodeFrame should be declared.

$frameType should contains the name of the frame type.

$frameRegex is the regex to use for parse the line.

decodeFrame is the method called after the parse of the line with the regex. The argument of this method is the third argument of preg_match function. So this argument contain all part of the message. Into this method, you can populate your properties with the line value.

bulton-fr/nmea-parser 适用场景与选型建议

bulton-fr/nmea-parser 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.61k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 05 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「parser」 「nmea」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 bulton-fr/nmea-parser 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 bulton-fr/nmea-parser 我们能提供哪些服务?
定制开发 / 二次开发

基于 bulton-fr/nmea-parser 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: LGPLv3
  • 更新时间: 2019-05-26