PHPackages                             sanmai/usb-scale-reader - 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. sanmai/usb-scale-reader

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

sanmai/usb-scale-reader
=======================

Standard USB scale reader library

v1.0.2(5y ago)3224210[1 issues](https://github.com/sanmai/usb-scale-reader/issues)MITPHPPHP &gt;=7.0CI passing

Since Feb 12Pushed 5y ago4 watchersCompare

[ Source](https://github.com/sanmai/usb-scale-reader)[ Packagist](https://packagist.org/packages/sanmai/usb-scale-reader)[ Docs](https://github.com/sanmai/usb-scale-reader)[ GitHub Sponsors](https://github.com/sanmai)[ RSS](/packages/sanmai-usb-scale-reader/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

USBScaleReader
==============

[](#usbscalereader)

[![Latest Stable Version](https://camo.githubusercontent.com/1c1f103241e75b0d87620e2959a015a02acf544a21ca24217767ee14f85000d9/68747470733a2f2f706f7365722e707567782e6f72672f73616e6d61692f7573622d7363616c652d7265616465722f762f737461626c65)](https://packagist.org/packages/sanmai/usb-scale-reader)

This library lets you read weight from a standard USB scale using pure PHP.

Could be ported to other languages with ease, should they have `unpack()`

Tested with:

- Stamps.com Stainless Steel 5 lb. Digital Scale
- DYMO M25 25 lb Digital Postal Scale

See [read\_stupid.php](example/read_stupid.php) or [usbscale.c](example/usbscale.c) if you want to understand how it works at a glance.

### Usage

[](#usage)

```
composer require sanmai/usb-scale-reader

```

And then:

```
$reader = \USBScaleReader\Reader::fromDevice('/dev/scale');
$weightInGrams = $reader->getWeight();
var_dump($reader, $weightInGrams);
```

Sample output:

```
class USBScaleReader\Reader#2 (5) {
  public $report =>
  int(3)
  public $status =>
  int(4)
  public $unit =>
  int(2)
  public $exponent =>
  int(0)
  public $weight =>
  int(144)
}
int(144)

```

### udev rules

[](#udev-rules)

Add to `/etc/udev/rules.d/80-persistent-scale.rules`:

```
KERNEL=="hidraw*", ATTRS{manufacturer}=="Maker Name", SYMLINK+="scale"
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0664", GROUP="plugdev"

```

Maker name is either `Stamps.com` or `DYMO`.

And then reconnect your scale.

For other makers see:

```
udevadm info -a -p  $(udevadm info -q path -n /dev/hidrawN)

```

These rules imply that you should be in `plugdev` for the scripts to work.

### C version

[](#c-version)

There is also [a simple reading program](example/usbscale.c) written in C.

To build it and run tests against PHP implementation:

```
cd example
make test

```

Usage is as simple as it can be:

```
./usbscale /dev/hidraw3

```

Outputs something like

```
70.87 g

```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~346 days

Total

3

Last Release

1959d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/edcb8dde95c71b1c97c3c91e57d3548795fa2014c657744fb878e2be3b5949fc?d=identicon)[sanmai](/maintainers/sanmai)

---

Top Contributors

[![sanmai](https://avatars.githubusercontent.com/u/139488?v=4)](https://github.com/sanmai "sanmai (40 commits)")

---

Tags

digital-scale

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/sanmai-usb-scale-reader/health.svg)

```
[![Health](https://phpackages.com/badges/sanmai-usb-scale-reader/health.svg)](https://phpackages.com/packages/sanmai-usb-scale-reader)
```

###  Alternatives

[xmo/mine-core

mineadmin core package

1684.2k1](/packages/xmo-mine-core)[bizley/cookiemonster

Yii extension to manage cookie warning.

2020.1k1](/packages/bizley-cookiemonster)[myth/collection

Javascript inspired, supercharged array object for PHP.

165.3k2](/packages/myth-collection)

PHPackages © 2026

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