PHPackages                             pkgmcp/fastboot-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. pkgmcp/fastboot-php

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

pkgmcp/fastboot-php
===================

PHP 8.3 implementation of the Android Fastboot protocol — full port of fastboot.js

1.0.0(3mo ago)01MITPHPPHP &gt;=8.3

Since Apr 26Pushed 3mo agoCompare

[ Source](https://github.com/pkgmcp/fastboot-php)[ Packagist](https://packagist.org/packages/pkgmcp/fastboot-php)[ Docs](https://github.com/pkgmcp/fastboot-php)[ RSS](/packages/pkgmcp-fastboot-php/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

fastboot-php
============

[](#fastboot-php)

> PHP 8.3 implementation of the Android Fastboot protocol — full port of [fastboot.js](https://github.com/kdrag0n/fastboot.js)

[![PHP ≥ 8.3](https://camo.githubusercontent.com/35f84bea2f0d533d925b00c1c13b3af86ee7404e60ac9afaf209d86454af7285/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344382e332d383839326266)](https://php.net)[![Tests](https://camo.githubusercontent.com/4a3f44e44cb7e87959d224e6b87d4700d7c25bcaeff1f63628b4485cd23c166c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54657374732d37382532306163726f73732532303925323066696c65732d677265656e)](tests/)[![Coverage](https://camo.githubusercontent.com/b13a29c71ceb119fbcd87202f16439b13710cb6ab3671f4fd948dde22664ac8d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f7665726167652d38392d2d39352532352d627269676874677265656e)](coverage/)[![License: MIT](https://camo.githubusercontent.com/d6bc2b26794002c24d023acaab01b6dbb953c57ab9cb80ba5b8aa2f2bd5de99a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c7565)](LICENSE)

---

What Is This?
-------------

[](#what-is-this)

**fastboot-php** lets you communicate with Android devices in fastboot/bootloader mode directly from PHP. No native extensions, no shell exec — pure PHP over USB or TCP.

A complete, idiomatic PHP 8.3+ port of [`fastboot.js`](https://github.com/kdrag0n/fastboot.js) by Danny Lin.

---

Requirements
------------

[](#requirements)

- PHP **8.3+**
- `ext-zip` (for `flashFactoryZip` — bundled with PHP)
- Linux udev rules for `LibUsbTransport` (optional — `TcpTransport` works without)

---

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

[](#installation)

```
composer require fastboot-php/fastboot-php
```

---

Quick Start
-----------

[](#quick-start)

```
use FastbootPhp\FastbootDevice;
use FastbootPhp\Common;
use FastbootPhp\Transport\LibUsbTransport;

Common::setDebugLevel(Common::LEVEL_DEBUG);

$device = new FastbootDevice(new LibUsbTransport('/dev/bus/usb/001/005'));
$device->connect();

echo $device->getVariable('product');  // "pixel7"
echo $device->getVariable('current-slot');  // "a"

$device->flashBlob('boot', file_get_contents('boot.img'), fn($p) => printf("%.0f%%\r", $p*100));
$device->reboot();
$device->disconnect();
```

---

Full Feature Map
----------------

[](#full-feature-map)

CategoryMethodStatus**Lifecycle**`connect()`, `disconnect()`, `isConnected()`✅**Commands**`runCommand(string)`✅**Variables**`getVariable(string)`, `getMaxDownloadSize()`✅**Upload**`upload(partition, data, ?cb)`✅**Flash**`flashBlob(partition, data, ?cb)`✅**Flash**`flashFactoryZip(zip, wipe, ?cb)`✅**Erase**`erase(partition)`✅**Lock**`lock()`, `unlock()`✅**Reboot**`reboot()`, `rebootBootloader()`, `rebootRecovery()`, `rebootFastbootd()`✅---

Missing Features (Known)
------------------------

[](#missing-features-known)

FeatureStatusReasonReal USB bulk-OUT with progress interrupts🟡 Partial`LibUsbTransport` uses basic fread/fwrite; libusb FFI would add cancellation supportSparse image DONT\_CARE / FILL chunk types🟡 PartialOnly RAW chunks are generated; DONT\_CARE detection would improve efficiency for zero-filled regionsSuper partition flashing🔴 Not implementedRequires LP metadata parsing (super.img) — not in fastboot.js eitherCustom AVB key flashing🔴 Not implementedRequires pk45 parsing — niche use case`verify()` / `get_staged()` commands🔴 Not implementedBootloader-specific, not universally supported> 📌 All missing features are either hardware-dependent, bootloader-specific, or were never in the upstream fastboot.js.

---

PHP 8.3 Features
----------------

[](#php-83-features)

FeatureUsed In`readonly class``CommandResponse``const int`11 typed constants across 3 classes`#[Override]`All 3 transport classes (21 methods)Named argumentsThroughout`match` expression`FastbootDevice::readResponse()``never` return typeError helpers---

Testing
-------

[](#testing)

```
composer install
./vendor/bin/phpunit --colors=always
```

**78 tests** across 9 files — all pass offline with no device required.

---

File Structure
--------------

[](#file-structure)

```
fastboot-php/
├── composer.json
├── README.md
├── CHANGELOG.md
├── SECURITY.md
├── LICENSE
├── phpunit.xml
├── src/
│   ├── FastbootDevice.php      # Main client (18 public methods)
│   ├── Sparse.php              # Sparse image parser/converter/splitter
│   ├── Common.php              # Debug logging (typed constants)
│   ├── CommandResponse.php     # readonly value object
│   ├── FastbootError.php       # Bootloader exception
│   ├── UsbError.php            # USB exception
│   ├── Contracts/
│   │   └── UsbTransportInterface.php
│   └── Transport/
│       ├── LibUsbTransport.php
│       ├── TcpTransport.php
│       └── MockTransport.php
├── tests/Unit/
│   ├── FastbootDeviceTest.php
│   ├── SparseTest.php
│   ├── CommonTest.php
│   ├── CommandResponseTest.php
│   ├── FastbootErrorTest.php
│   ├── UsbErrorTest.php
│   ├── Transport/
│   │   └── MockTransportTest.php
│   └── Integration/
│       ├── FlashBlobTest.php
│       └── TransportTest.php
├── examples/
│   ├── basic_usage.php
│   ├── factory_flash.php
│   ├── tcp_usage.php
│   └── mock_test.php
└── docs/
    ├── OVERVIEW.md
    ├── INSTALL.md
    ├── API.md
    ├── TRANSPORT.md
    ├── ERROR_HANDLING.md
    └── PORTING_NOTES.md

```

---

Credits
-------

[](#credits)

- Original: [fastboot.js](https://github.com/kdrag0n/fastboot.js) by Danny Lin — MIT License
- Android sparse image format: [AOSP libsparse](https://android.googlesource.com/platform/system/core/+/refs/heads/main/libsparse/)

---

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance82

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

90d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/40be284b8dd88b2d48b0d446df171ae05f8eaaf44ab18b948766c6fafc76f9f4?d=identicon)[shamimstack](/maintainers/shamimstack)

---

Tags

flashandroidbootloaderusbfastbootsparse

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pkgmcp-fastboot-php/health.svg)

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

###  Alternatives

[nativephp/mobile

NativePHP for Mobile

1.1k75.1k106](/packages/nativephp-mobile)[plasticbrain/php-flash-messages

A modern take on PHP session-based flash messages

184229.8k8](/packages/plasticbrain-php-flash-messages)[nelexa/google-play-scraper

Scrapes app data from Google Play store.

89505.3k](/packages/nelexa-google-play-scraper)[coderello/laraflash

Advanced flash messages for Laravel.

15737.2k1](/packages/coderello-laraflash)[chiiya/laravel-passes

Laravel library for creating iOS and Android Wallet Passes

37114.8k](/packages/chiiya-laravel-passes)[caffeinated/flash

Flash Messages for Laravel

4350.4k2](/packages/caffeinated-flash)

PHPackages © 2026

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