Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Gpio Laravel Package

ronanguilloux/php-gpio

PHP-GPIO provides an object-oriented interface to Raspberry Pi GPIO pins, letting PHP applications read inputs, set outputs, and configure pin modes. Useful for prototyping and controlling LEDs, relays, sensors, and other hardware from PHP.

Deep Wiki
Context7

ronanguilloux/php-gpio is an object-oriented PHP library for driving the GPIO pins of a Raspberry Pi. It communicates through the kernel's sysfs interface (/sys/class/gpio), letting you toggle LEDs and relays or read buttons and sensors from plain PHP—no C extension or PECL module required. Install it with Composer and address pins by number via the Board and Pin classes.

  • Simple read/write of pin values (setValue() / getValue())
  • Configure pin direction as input or output
  • Clean object-oriented API (Board, Pin) with Composer autoloading
  • Ships a CLI for quick pin checks and prototyping
  • Runs on any Raspberry Pi Linux system exposing sysfs GPIO
Frequently asked questions about Php Gpio
How do I install ronanguilloux/php-gpio in a Laravel project?
Install it with Composer as a normal dependency, but treat it as a standalone hardware library rather than a Laravel package. You will need to create your own service provider, configuration file, and application-owned interface to avoid referencing the package directly in controllers or jobs. It only works on a Raspberry Pi or compatible host where the sysfs GPIO tree is exposed.
Is ronanguilloux/php-gpio a Laravel package?
No. It is a thin object-oriented PHP wrapper over the Linux sysfs GPIO interface at /sys/class/gpio. It does not ship a Laravel service provider, facade, config file, or framework integration. In Laravel it fits only as an edge-device adapter behind a service class or interface.
Which Raspberry Pi models and Raspberry Pi OS versions does php-gpio support?
The library targets the legacy sysfs GPIO interface, so it is most likely to work on older Raspbian images where /sys/class/gpio is available and writable. sysfs GPIO has been deprecated since Linux 4.8 and may be absent or restricted on newer Raspberry Pi OS kernels. Validate availability and permissions on the exact Pi models and OS images in your fleet before committing.
Does ronanguilloux/php-gpio work with PHP 8.2 and Laravel 11?
PHP 8 compatibility is unverified because the last release dates from 2013. PSR-4 autoloading, deprecation notices, and runtime behavior under PHP 8.2+ should be checked with static analysis and a hardware smoke test. If patches are needed, pin the dependency to a commit and maintain a fork under your own namespace.
How can I test GPIO code in Laravel without Raspberry Pi hardware?
The package has no mocking layer, and standard CI runners do not expose the GPIO sysfs tree. Define your own PinReader and PinWriter interfaces, bind a real php-gpio adapter in production, and use an in-memory fake for tests and local development. Keep hardware-specific smoke tests on a representative Pi rather than in normal CI.
What permissions are needed to use php-gpio from PHP-FPM?
The PHP process needs write access to the relevant /sys/class/gpio paths, typically via root, the gpio group, or targeted sudoers rules. Design the permission model up front because PHP-FPM often runs as www-data and should not run as root. Container deployments also need /sys/class/gpio and /dev/gpiochip device access plus suitable capabilities or group membership.
What are the alternatives to ronanguilloux/php-gpio for Raspberry Pi GPIO in PHP?
Consider libgpiod bindings, PHP FFI against libgpiod, or a Python or Node sidecar that exposes a small local API. These options align better with the gpiochip character device interface used on modern kernels. Abstract your application behind an interface so you can swap implementations without changing call sites.
Can I use php-gpio for PWM, sensors, or precise timing in Laravel?
php-gpio is a poor fit for PWM, precise timing, or latency-sensitive work. sysfs GPIO is suitable for low-frequency, single-process control such as relays, status LEDs, and simple sensors. A PHP process cannot guarantee the timing or jitter characteristics that many hardware projects require.
How should I configure GPIO pin numbers and active-low polarity in Laravel?
Keep pin numbers, active-high or active-low polarity, and initial states in a config file such as config/gpio.php. Bind your application-owned GPIO interface in a service provider and keep all php-gpio types behind that boundary. Avoid scattering pin numbers or direct package calls through controllers and jobs.
Is ronanguilloux/php-gpio maintained and safe for production?
The package appears abandoned, with the last release in 2013 and an effectively single, inactive maintainer. The MIT license removes legal friction, but PHP 8 compatibility, kernel support, and security posture are unverified. Treat it as high technical risk, pin a specific commit or fork it, and plan a migration path to libgpiod or a sidecar implementation.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons