PHPackages                             aln/speedtest-php - 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. aln/speedtest-php

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

aln/speedtest-php
=================

Library and command line interface for testing internet bandwidth using speedtest.net

v1.0.8(2y ago)87.0k↑33.3%3Apache-2.0PHPPHP &gt;=7.0

Since May 25Pushed 2y ago1 watchersCompare

[ Source](https://github.com/aln-1/speedtest-php)[ Packagist](https://packagist.org/packages/aln/speedtest-php)[ Docs](https://github.com/aln-1/speedtest-php)[ RSS](/packages/aln-speedtest-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (10)Used By (0)

speedtest-php
=============

[](#speedtest-php)

Library and command line interface for testing internet bandwidth using speedtest.net.

The goal of this project is to run server-side speedtest, from cli or web interface.

[![Latest Stable Version](https://camo.githubusercontent.com/c5de1bd245d1b42ef815bce9e4d0624cc9a307f02f0797abb5b42dcefc7b75bb/68747470733a2f2f706f7365722e707567782e6f72672f616c6e2f7370656564746573742d7068702f76)](//packagist.org/packages/aln/speedtest-php)[![Total Downloads](https://camo.githubusercontent.com/5c9478f84b68defbec4e3ba92f8ccaaeaedf57f93143844817c0a6c5113c1ab2/68747470733a2f2f706f7365722e707567782e6f72672f616c6e2f7370656564746573742d7068702f646f776e6c6f616473)](//packagist.org/packages/aln/speedtest-php)[![Latest Unstable Version](https://camo.githubusercontent.com/bb4998b0b7043e8c099b8b99dd6ec6c2dd45dcc8d6f23ec3127902cce4af18fd/68747470733a2f2f706f7365722e707567782e6f72672f616c6e2f7370656564746573742d7068702f762f756e737461626c65)](//packagist.org/packages/aln/speedtest-php)[![License](https://camo.githubusercontent.com/ac386815241a185f84095fab2940996add3676937791071d485edc82145789f2/68747470733a2f2f706f7365722e707567782e6f72672f616c6e2f7370656564746573742d7068702f6c6963656e7365)](//packagist.org/packages/aln/speedtest-php)[![composer.lock](https://camo.githubusercontent.com/2898ed055fb64fc222004c4aca18c913af8c18a94a068434c6a077add591f51f/68747470733a2f2f706f7365722e707567782e6f72672f616c6e2f7370656564746573742d7068702f636f6d706f7365726c6f636b)](//packagist.org/packages/aln/speedtest-php)[![php version](https://camo.githubusercontent.com/aba6b529db4de58705ddb039e75213c8d6ff89b756b8bd8d039da371ca60201a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e302d626c7565)](//packagist.org/packages/aln/speedtest-php)

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

[](#installation)

### As standalone package

[](#as-standalone-package)

Download and install with

```
composer install
```

then run

```
./bin/speedtest
```

[![speedtest-php demo](resources/speedtest-php.gif)](resources/speedtest-php.gif)

*(IP adress was hidden for the demo)*

### As project dependency

[](#as-project-dependency)

```
composer require aln/speedtest-php
```

then run

```
./vendor/bin/speedtest
```

CLI Usage
---------

[](#cli-usage)

```
$ ./bin/speedtest -h

usage: speedtest [-h] [--no-download] [--no-upload] [--single] [--bytes]
                 [--share] [--simple] [--json] [--list] [--server=SERVER]
                 [--exclude=EXCLUDE] [--source=SOURCE] [--timeout=TIMEOUT]
                 [--version]

Command line interface for testing internet bandwidth using speedtest.net.
--------------------------------------------------------------------------
https://github.com/aln-1/speedtest-php

optional arguments:
  -h, --help            show this help message and exit
  --no-download         Do not perform download test
  --no-upload           Do not perform upload test
  --single              Only use a single connection instead of multiple. This
                        simulates a typical file transfer
  --bytes               Display values in bytes instead of bits. Does not
                        affect the image generated by --share, nor output from
                        --json
  --share               Generate and provide a URL to the speedtest.net share
                        results image
  --simple              Suppress verbose output and progress, only shows results
  --json                Output in JSON format. Speeds listed in bits and not
                        affected by --bytes. Can be combined with --simple
                        to supress progress
  --list                Display a list of speedtest.net servers sorted by
                        distance
  --server=SERVER       Specify a server ID to test against. Can be comma
                        separated values
  --exclude=EXCLUDE     Exclude a server from selection. Can be comma
                        separated values
  --source=SOURCE       Source IP address to bind to or interface name
  --timeout=TIMEOUT     HTTP timeout in seconds, default 10
  --version             Show the version number

```

Library
-------

[](#library)

### Minimal code

[](#minimal-code)

```
$ php -a
Interactive shell

php > require 'vendor/autoload.php';
php > $speedtest = new Aln\Speedtest\Speedtest();
php > $speedtest->getServers();
php > $speedtest->getBestServer();
php > $speedtest->download();
php > $speedtest->upload();
php > $results = $speedtest->results();
php > print_r($results);
Aln\Speedtest\Result Object
(
    [latency:protected] => 4.57
    [download:protected] => 47888585.578516
    [upload:protected] => 64841042.860629
    [bytesReceived:protected] => 59881235
    [bytesSent:protected] => 82579808
)
```

Units:

- latency = ms
- download / upload = bits/s
- bytesReceived / bytesSent = bytes

### With progress callback

[](#with-progress-callback)

```
$ php -a
Interactive shell

php > require 'vendor/autoload.php';
php > $config = new Aln\Speedtest\Config();
php > $config->setCallback(function ($results) { print_r($results); });
php > $speedtest = new Aln\Speedtest\Speedtest($config);
php > $speedtest->getServers();
php > $speedtest->getBestServer();
php > $speedtest->download();
Aln\Speedtest\Result Object
(
    [latency:protected] => 4.40
    [download:protected] => 0
    [upload:protected] =>
    [bytesReceived:protected] => 0
    [bytesSent:protected] => 0
)

// More dump was here ...

Aln\Speedtest\Result Object
(
    [latency:protected] => 4.40
    [download:protected] => 27519752.835724
    [upload:protected] =>
    [bytesReceived:protected] => 37153149
    [bytesSent:protected] => 0
)
```

*(showing only first and last callback results from the download method)*

Web demo
--------

[](#web-demo)

A one page demo is available at `resources/demo.php`

[![speedtest-php demo 2](resources/speedtest-php-2.gif)](resources/speedtest-php-2.gif)

Credits
-------

[](#credits)

This project is ported from the [Python version](https://github.com/sivel/speedtest-cli) by Matt Martz

License
-------

[](#license)

This project is licensed under the Apache License Version 2.0 - see the [LICENSE](LICENSE) file for details

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.9% 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 ~172 days

Recently: every ~344 days

Total

9

Last Release

802d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/17613001?v=4)[aln-1](/maintainers/aln-1)[@aln-1](https://github.com/aln-1)

---

Top Contributors

[![aln-1](https://avatars.githubusercontent.com/u/17613001?v=4)](https://github.com/aln-1 "aln-1 (10 commits)")[![noxify](https://avatars.githubusercontent.com/u/521777?v=4)](https://github.com/noxify "noxify (1 commits)")

---

Tags

speedtest bandwidth

### Embed Badge

![Health badge](/badges/aln-speedtest-php/health.svg)

```
[![Health](https://phpackages.com/badges/aln-speedtest-php/health.svg)](https://phpackages.com/packages/aln-speedtest-php)
```

###  Alternatives

[htmlburger/carbon-fields

WordPress developer-friendly custom fields for post types, taxonomy terms, users, comments, widgets, options and more.

1.5k665.2k57](/packages/htmlburger-carbon-fields)[tightenco/tlint

Tighten linter for Laravel conventions

5271.2M34](/packages/tightenco-tlint)[dflydev/placeholder-resolver

Given a data source representing key =&gt; value pairs, resolve placeholders like ${foo.bar} to the value associated with the 'foo.bar' key in the data source.

14414.6M3](/packages/dflydev-placeholder-resolver)[pear/pear

This is the definitive source of PEAR's core files.

1161.7M20](/packages/pear-pear)[pragmarx/ia-collection

Laravel Illuminate Agnostic Collection

473.4M2](/packages/pragmarx-ia-collection)[saade/filament-autograph

A Filament package to manage signatures.

80195.0k](/packages/saade-filament-autograph)

PHPackages © 2026

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