PHPackages                             graftype/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. [File &amp; Storage](/categories/file-storage)
4. /
5. graftype/speedtest-php

ActiveLibrary[File &amp; Storage](/categories/file-storage)

graftype/speedtest-php
======================

Speedtest.net for PHP | Library and command line interface

1.0.13(1y ago)31.5k↓100%1[1 issues](https://github.com/graftype/speedtest-php/issues)Apache-2.0PHPPHP &gt;=7.0

Since Nov 7Pushed 1y ago4 watchersCompare

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

READMEChangelog (10)Dependencies (1)Versions (14)Used By (0)

Speedtest.net for PHP
=====================

[](#speedtestnet-for-php)

Library and command line interface to run server-side speedtests via [Speedtest.net](https://www.speedtest.net/) from cli or web interface.

[![demo](resources/demo.gif)](resources/demo.gif)

This library is an updated version of [aln-1/speedtest-php](https://github.com/aln-1/speedtest-php) ported from the Python version [sivel/speedtest-cli](https://github.com/sivel/speedtest-cli).

[![Latest Version](https://camo.githubusercontent.com/727424d2e596ebf2326e8ffe2cf6239917a035ccf0535dfe3576d0a50ad537ad/68747470733a2f2f706f7365722e707567782e6f72672f67726166747970652f7370656564746573742d7068702f76)](//packagist.org/packages/graftype/speedtest-php)[![Total Downloads](https://camo.githubusercontent.com/0352458c66871873f0b0d0b23a70add1af69cfe3e17df091071351d06b822e78/68747470733a2f2f706f7365722e707567782e6f72672f67726166747970652f7370656564746573742d7068702f646f776e6c6f616473)](//packagist.org/packages/graftype/speedtest-php)[![License](https://camo.githubusercontent.com/aa1eee60e219d05c11a6566a8533746f9beaaa0ab67d6dbc6c63c13b9ddfc3a0/68747470733a2f2f706f7365722e707567782e6f72672f67726166747970652f7370656564746573742d7068702f6c6963656e7365)](//packagist.org/packages/graftype/speedtest-php)[![PHP Version](https://camo.githubusercontent.com/aba6b529db4de58705ddb039e75213c8d6ff89b756b8bd8d039da371ca60201a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e302d626c7565)](//packagist.org/packages/graftype/speedtest-php)

Navigation
==========

[](#navigation)

- [Installation](#installation)
    - [How to install library **to existing project** using Composer](#how-to-install-library-to-existing-project-using-composer)
        - [As project dependency](#as-project-dependency)
        - [By updating composer.json file of your project](#by-updating-composerjson-file-of-your-project)
    - [How to install library **to new project** using Composer](#how-to-install-library-to-new-project-using-composer)
- [Update](#update)
- [Examples](#examples)
    - [Regular Usage](#regular-usage)
        - [Minimal code](#)
        - [With progress callback](#)
    - [CLI Usage](#cli-usage)
- [Support](#support)
- [Paid Consultations &amp; Personal Help](#paid-consultations--personal-help)

Installation
============

[](#installation)

How to install library **to existing project** using Composer
-------------------------------------------------------------

[](#how-to-install-library-to-existing-project-using-composer)

Since, our repository are public package we listed this repository on Packagist, that's mean we don't need to instruct Composer about which GitHub repository to look for inorder to find the package.

### As project dependency

[](#as-project-dependency)

- Install library using the following commands:

```
cd /path-to-app/
composer require graftype/speedtest-php
```

### By updating composer.json file of your project

[](#by-updating-composerjson-file-of-your-project)

- Open file named as `composer.json` in project folder `/path-to-app/`
- Add following content to this file:

```
{
    "require": {
        // ---
        // Other packages
        // ---
        "graftype/speedtest-php": "^1.0"
    }
}
```

- After that install library using the following commands:

```
cd /path-to-app/
composer update
```

- `/path-to-app/` project folder with existing `composer.json` file

How to install library **to new project** using Composer
--------------------------------------------------------

[](#how-to-install-library-to-new-project-using-composer)

Use following command, when you need to install library **to new project** using Composer:

- If Composer not installed on your server/local machine, please follow this [installation guide](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-composer-on-ubuntu-20-04)
- Create blank file named as `composer.json` in project folder
- Add following content to this file:

```
{
    "require": {
        "graftype/speedtest-php": "^1.0"
    }
}
```

- After that install library using the following command:

```
cd /path-to-app/
composer update
```

- `/path-to-app/` project folder with existing `composer.json` file

Update
======

[](#update)

Use following command, when you need to update library to latest version:

```
cd /path-to-app/
composer update
```

- `/path-to-app/` project folder with existing `composer.json` file

Examples
========

[](#examples)

Regular Usage
-------------

[](#regular-usage)

### Minimal code

[](#minimal-code)

Code:

```
require 'vendor/autoload.php';

$speedtest = new Graftype\Speedtest\Speedtest();
$speedtest->getServers();
$speedtest->getBestServer();
$speedtest->download();
$speedtest->upload();

$results = $speedtest->results();

print_r($results);
```

Output:

```
Graftype\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)

Code:

```
require 'vendor/autoload.php';

$config = new Graftype\Speedtest\Config();
$config->setCallback(function ($results) { print_r($results); });

$speedtest = new Graftype\Speedtest\Speedtest($config);
$speedtest->getServers();
$speedtest->getBestServer();
$speedtest->download();
```

Output:

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

// More dump was here ...

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

Units:

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

We are showing here 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)

CLI Usage
---------

[](#cli-usage)

Console:

```
/path-to-app/vendor/bin/speedtest -h
```

Output:

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

Command line interface to run server-side speedtests via Speedtest.net from cli or web interface.
--------------------------------------------------------------------------
https://github.com/graftype/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
  --proxy=PROXY         Use a proxied connection for test
  --version             Show the version number
```

- `/path-to-app/` project folder

Support
=======

[](#support)

This is a developer's portal for Speedtest.net for PHP and should not be used for support. Please [contact us via website chat](https://graftype.com/#chatraChatExpanded) if you need to submit a support request.

Paid Consultations &amp; Personal Help
======================================

[](#paid-consultations--personal-help)

Please [contact us via website chat](https://graftype.com/#chatraChatExpanded) if you need additional help with your own project, we will try to find best options for you.

###  Health Score

32

—

LowBetter than 71% of packages

Maintenance41

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity48

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 ~70 days

Recently: every ~97 days

Total

13

Last Release

429d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/897ac1a2442a3b169df65481f561426c159810f90ce79b9665e896883420ebba?d=identicon)[sergeykomlev](/maintainers/sergeykomlev)

---

Top Contributors

[![sergeykomlev](https://avatars.githubusercontent.com/u/40078038?v=4)](https://github.com/sergeykomlev "sergeykomlev (29 commits)")

---

Tags

phpuploaddownloadspeedbandwidthspeedtestspeedtest-netookla

### Embed Badge

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

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

###  Alternatives

[eddturtle/direct-upload

Composer Package to build an AWS Signature ready to Direct Upload to S3

88728.1k2](/packages/eddturtle-direct-upload)[blueimp/jquery-file-upload

File Upload widget for jQuery.

141.5M17](/packages/blueimp-jquery-file-upload)[unisharp/s3-presigned

An AWS S3 package for pre-signed upload purpose in Laravel and PHP.

141.8k](/packages/unisharp-s3-presigned)

PHPackages © 2026

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