PHPackages                             dept-of-scrapyard-robotics/sh1106 - 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. [Framework](/categories/framework)
4. /
5. dept-of-scrapyard-robotics/sh1106

ActiveLibrary[Framework](/categories/framework)

dept-of-scrapyard-robotics/sh1106
=================================

Drive SH1106 Monochrome displays over I2C with PHP

0.4.3(yesterday)00MITPHPPHP ^8.3

Since Dec 27Pushed yesterdayCompare

[ Source](https://github.com/DeptOfScrapyardRobotics/SH1106)[ Packagist](https://packagist.org/packages/dept-of-scrapyard-robotics/sh1106)[ Docs](https://dosr.projectsaturnstudios.com)[ RSS](/packages/dept-of-scrapyard-robotics-sh1106/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (3)Versions (5)Used By (0)

Introduction
============

[](#introduction)

PHP Package for the SH1106 Monochrome OLED display.

Compatible I2C Interfaces
=========================

[](#compatible-i2c-interfaces)

The SH1106 display communicates with your device over I2C, the InterIntegrated Circuit Protocol.

You can interface with displays such as the SH1106 with this package the following ways:

- A Linux Single-Board Computer's exposed GPIO pins using the dedicated I2C SDA/SCL pins
- An MPSSE-enabled USB-to-Serial device such as an FT232H generally using D0 and SCL and D1 for SDA connected to nearly any Linux or MacOS USB port.

Dependencies
============

[](#dependencies)

This package makes use of modules within:

- [The ScrapyardIO Framework](https://github.com/ScrapyardIO/framework)

This package also requires one of the following extensions in order to interface with I2C

- [POSI Extension v^0.4.0 or newer](https://github.com/php-io-extensions/posi)
- [FTDI Extension v^0.4.0 or newer](https://github.com/php-io-extensions/ftdi)

In addition, an extension wrapper package is needed

For ext-posi

- [Microscrap POSIX Package v0.4.0 or newer](https://github.com/microscrap/posix)
- [Microscrap Native I2C Package v0.4.0 or newer](https://github.com/microscrap/i2c)
- [Microscrap Native GPIO Package v0.4.0 or newer](https://github.com/microscrap/gpio)

For ext-ftdi

- [Microscrap FTDI Package v0.4.0 or newer](https://github.com/microscrap/ftdi)
- [Microscrap MPSSE Package v0.4.0 or newer](https://github.com/microscrap/mpsse)

Installing from Composer
========================

[](#installing-from-composer)

Inside the root of your PHP Project, simply require the SH1106 package from composer

```
composer require dept-of-scrapyard-robotics/sh1106
```

Framework Configuration
=======================

[](#framework-configuration)

If you would like to use the ScrapyardIO Framework to bootstrap your display without wasting lines configuring your display right in the script you can add your desired configuration to scrapyard-io.php, such as in this example:

### I2C

[](#i2c)

```
use DeptOfScrapyardRobotics\Displays\SH1106\SH1106\SH1106;
use DeptOfScrapyardRobotics\Displays\SH1106\SH1106\Enums\SH1106I2CAddress;

return [
    'displays' => [
        // For Native Configurations
        'sh1106-native' => [
            'class_name' => SH1106::class,
            'connection' => ['driver' => 'native'],
            'startup' => [
                'i2c' => [
                    'chip_device' => 1,
                    'slave_address' => SH1106I2CAddress::SAO_GROUNDED->value,
                ],
            ],
        ],
        // For USB Configurations
        'sh1106-usb' => [
            'class_name' => SH1106::class,
            'connection' => ['driver' => 'usb'],
            'startup' => [
                'i2c' => [
                    'chip_device' => 'ft232h',
                    'slave_address' => SH1106I2CAddress::SAO_GROUNDED->value,
                ],
            ],
        ],
    ]
];
```

Basic Usage
===========

[](#basic-usage)

### Native (POSIX) I2C driver. (Single Board Computers)

[](#native-posix-i2c-driver-single-board-computers)

```
use DeptOfScrapyardRobotics\Displays\SH1106\SH1106\SH1106;
use DeptOfScrapyardRobotics\Displays\SH1106\SH1106\Enums\SH1106I2CAddress;

$native_i2c_display = SH1106::connection('native')
    ->i2c(1, SH1106I2CAddress::SAO_GROUNDED->value)
    ->create()
```

### USB (MPSSE) driver using I2C. (Linux and MacOS)

[](#usb-mpsse-driver-using-i2c-linux-and-macos)

```
use DeptOfScrapyardRobotics\Displays\SH1106\SH1106\SH1106;
use DeptOfScrapyardRobotics\Displays\SH1106\SH1106\Enums\SH1106I2CAddress;

$usb_i2c_display = SH1106::connection('usb')
    ->i2c('ft232h', SH1106I2CAddress::SAO_GROUNDED->value)
    ->create()
```

Alternative Usage
-----------------

[](#alternative-usage)

### Using Through the Display Library (as a MonochromeDisplay)

[](#using-through-the-display-library-as-a-monochromedisplay)

```
use DeptOfScrapyardRobotics\Displays\SH1106\SH1106\SH1106;
use RealityInterface\Displays\Applied\Monochrome\MonochromeDisplay;
use DeptOfScrapyardRobotics\Displays\SH1106\SH1106\Enums\SH1106I2CAddress;

$sh1106 = SH1106::connection('native')
    ->i2c(1, SH1106I2CAddress::SAO_GROUNDED->value)
    ->create()

$display = MonochromeDisplay::as($sh1106);
```

### Using Through the Display Framework (with an autoloaded config) (as a MonochromeDisplay)

[](#using-through-the-display-framework-with-an-autoloaded-config-as-a-monochromedisplay)

```
use RealityInterface\Displays\Applied\Monochrome\MonochromeDisplay;

$display = MonochromeDisplay::using('sh1106-native');
```

Display API
===========

[](#display-api)

The setters and property access in this API interface with the device directly (register writes/reads), so you can use property access while still working against the panel itself.

Readable Properties (Getters)
-----------------------------

[](#readable-properties-getters)

- `$display->display_on`Returns whether the panel is currently on.
- `$display->offset`Returns the current vertical display offset.
- `$display->contrast`Returns the current contrast value (0–255).
- `$display->start_line`Returns the current display RAM start line.
- `$display->charge_pump`Returns whether the internal charge-pump regulator is enabled.
- `$display->flip_line_0_and_127`Returns whether segments are mirrored (horizontal flip).
- `$display->flip_line_scan_dir`Returns whether the COM scan direction is reversed (vertical flip).
- `$display->com_pins_config` (`SH1106COMPinsHWConfig`) Returns the current COM pin hardware configuration.
- `$display->powered_by_host_device`Returns whether the panel is treated as host-powered.
- `$display->v_com_h` (`SH1106VoltageCommonHigh`) Returns the current VCOMH deselect level.
- `$display->vpp` (`SH1106PumpVoltage`) Returns the current charge-pump output voltage.
- `$display->fill_overlay_on`Returns whether the fill overlay is enabled.

Writable Properties (Setters)
-----------------------------

[](#writable-properties-setters)

- `$display->display_on = true;`Turns the panel on or off.
- `$display->offset = 0;`Sets the vertical display offset (COM shift).
- `$display->contrast = 191;`Sets the contrast/brightness (0–255).
- `$display->start_line = 0;`Sets the display RAM start line.
- `$display->charge_pump = true;`Enables or disables the internal charge-pump regulator.
- `$display->flip_line_0_and_127 = true;`Mirrors the segments (horizontal flip).
- `$display->flip_line_scan_dir = true;`Reverses the COM scan direction (vertical flip).
- `$display->com_pins_config = new SH1106COMPinsHWConfig(...);`Sets the COM pin hardware configuration.
- `$display->powered_by_host_device = true;`Adjusts the precharge period for host-powered vs externally powered panels.
- `$display->v_com_h = SH1106VoltageCommonHigh::LEVEL_077_ALT;`Sets the VCOMH deselect level.
- `$display->vpp = SH1106PumpVoltage::PUMP_VOLTAGE_900;`Sets the charge-pump output voltage.
- `$display->fill_overlay_on = true;`Toggles the fill overlay.

Drawing on the Display
======================

[](#drawing-on-the-display)

Draw with a `Screen`, which wraps a `GFXRenderer` over a frame buffer matched to the panel's `FormatSpec`, then ships the bytes on `render()`. A monochrome OLED uses a `PageSegmentBuffer` (one update per dirty 8-row page). Colors are `0`(pixel off) and `1` (pixel on).

```
use DeptOfScrapyardRobotics\Displays\SH1106\SH1106\SH1106;
use DeptOfScrapyardRobotics\Displays\SH1106\SH1106\Enums\SH1106I2CAddress;
use Microscrap\GFX\PhpdaFruit\Buffers\PageSegmentBuffer;
use Microscrap\GFX\PhpdaFruit\GFXRenderer;
use RealityInterface\Displays\Applied\Monochrome\MonochromeDisplay;
use RealityInterface\Displays\Screen;

$sh1106 = SH1106::connection('usb')
    ->i2c('ft232h', SH1106I2CAddress::SAO_GROUNDED->value)
    ->create();

$display = MonochromeDisplay::as($sh1106);

$buffer = new PageSegmentBuffer($display->width(), $display->height(), $display->getFormatSpec());
$screen = new Screen($display, new GFXRenderer($buffer));

$screen
    ->fill(0)
    ->drawRect(0, 0, $display->width(), $display->height(), 1)
    ->setTextColor(1)
    ->setCursor(8, 24)
    ->print('Hello from PHP')
    ->render();
```

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity43

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

Every ~56 days

Total

4

Last Release

1d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10563160?v=4)[Angel Gonzalez](/maintainers/projectsaturnstudios)[@projectsaturnstudios](https://github.com/projectsaturnstudios)

---

Tags

frameworkscrapyard-io

### Embed Badge

![Health badge](/badges/dept-of-scrapyard-robotics-sh1106/health.svg)

```
[![Health](https://phpackages.com/badges/dept-of-scrapyard-robotics-sh1106/health.svg)](https://phpackages.com/packages/dept-of-scrapyard-robotics-sh1106)
```

###  Alternatives

[pestphp/pest-plugin-stressless

Stressless plugin for Pest

68943.9k18](/packages/pestphp-pest-plugin-stressless)

PHPackages © 2026

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