PHPackages                             nykopol/gpsd-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. nykopol/gpsd-client

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nykopol/gpsd-client
===================

Client class for GPSD service

1.0.1(6y ago)44.7k↓58.3%LGPL-3.0PHPPHP &gt;=5.3||^7.0

Since Nov 11Pushed 6y ago1 watchersCompare

[ Source](https://github.com/nykopol/gpsd-client)[ Packagist](https://packagist.org/packages/nykopol/gpsd-client)[ RSS](/packages/nykopol-gpsd-client/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (3)Used By (0)

GPSD Client
===========

[](#gpsd-client)

[![SensioLabsInsight](https://camo.githubusercontent.com/dab8dd1e5d5bbbe4fc32509d56f0095ce6bc00ca76dc71a5f9dfefb335993501/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f39393263343335362d363835632d346263372d386131342d3562396138313033616466342f6269672e706e67)](https://insight.sensiolabs.com/projects/992c4356-685c-4bc7-8a14-5b9a8103adf4)

PHP Client to retrieve informations from a GPSD service. More informations about GPSD:

Installation
------------

[](#installation)

```
composer require nykopol/gpsd-client 1.*

```

Usage
-----

[](#usage)

Basic usage :

```
$client = new Client(); // new client for localhost on port 2947
$client->connect(); // Initiate socket with the service
$client->watch();   // Tell the service to start report event
$infos = $client->getNext('TPV'); // Get the next message of class TPV ()
```

Documentation
-------------

[](#documentation)

### \_\_construct($host = 'localhost', $port = 2947)

[](#__constructhost--localhost-port--2947)

The class instantiation accept two parameters: *$host* `string` (default: `localhost`) the host we want to listen to *$port* `integer` (default: `2947`) the socket port

### connect()

[](#connect)

This method connect the socket to the service. The returned value is the string returned by the service identifying itself. ex.: `{"class":"VERSION","release":"2.93","rev":"2010-03-30T12:18:17", "proto_major":3,"proto_minor":2}`

### watch($enable = true, $format = 'json')

[](#watchenable--true-format--json)

The watch method tell the service to start report sensors events. This method accept two parameters: *$enable* `bool` (default: `true`) Tell the service to start or stop watching. *$format* `string` (default: `json`) Set the desired format for the returned datas

### getNext($class, $buffer = false, $blocking = true)

[](#getnextclass-buffer--false-blocking--true)

Return the next message of the given class. Current service class are `WATCH`, `DEVICES`, `DEVICE`, `TPV`, `AIS`. The method accept the tree parameters: *$class* `string` The wanted class name. *$buffer* `bool` (default: `false`) Once the device synced, the service is generaly reporting one message per second. This parameter specify if we want the next message from the buffer or the next message in the time. *$blocking* `bool` (default: `true`) Wait for the next message or return null if there is no new message. This option is relevant only if the buffer is enabled.

For exemple, if you are connected to the service since 1 minute, and that the sensor is synced, the next message from the buffer is proably old of about 1 minute. While requesting the next message in time will flush the buffer then wait for the next message of the desired class.

The returned value is the raw string returned by the service. So if you asked for json format with the `watch()` method, the returne value will look like : `{"class":"TPV","tag":"MID2","time":"2010-04...`

### disconnect()

[](#disconnect)

Disconnect from the service.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1701 days

Total

2

Last Release

2541d ago

PHP version history (2 changes)1.0PHP &gt;=5.3

1.0.1PHP &gt;=5.3||^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/1b12ed423a03cfb7eb41e4a0b5c1182ab30271cfc4f3f3e5962bb73873aca37f?d=identicon)[nykopol](/maintainers/nykopol)

---

Top Contributors

[![nykopol](https://avatars.githubusercontent.com/u/2706685?v=4)](https://github.com/nykopol "nykopol (7 commits)")[![kduma](https://avatars.githubusercontent.com/u/1062582?v=4)](https://github.com/kduma "kduma (1 commits)")

### Embed Badge

![Health badge](/badges/nykopol-gpsd-client/health.svg)

```
[![Health](https://phpackages.com/badges/nykopol-gpsd-client/health.svg)](https://phpackages.com/packages/nykopol-gpsd-client)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
