- 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.