{"id":15043689,"url":"https://github.com/amnuts/phpiwire","last_synced_at":"2025-07-06T20:05:52.828Z","repository":{"id":56947285,"uuid":"37943053","full_name":"amnuts/phpiwire","owner":"amnuts","description":"A PHP extension (written using Zephir) that interfaces with wiringPi, allowing you to easily control your Raspberry Pi's GPIO using PHP.","archived":false,"fork":false,"pushed_at":"2016-06-22T13:54:24.000Z","size":118,"stargazers_count":13,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T00:44:15.259Z","etag":null,"topics":["gpio","php","php-extension","raspberry-pi","raspberrypi","wiringpi","wiringpi-library","zephir"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amnuts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-23T20:26:12.000Z","updated_at":"2020-08-17T03:08:03.000Z","dependencies_parsed_at":"2022-08-21T03:10:29.158Z","dependency_job_id":null,"html_url":"https://github.com/amnuts/phpiwire","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/amnuts/phpiwire","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amnuts%2Fphpiwire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amnuts%2Fphpiwire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amnuts%2Fphpiwire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amnuts%2Fphpiwire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amnuts","download_url":"https://codeload.github.com/amnuts/phpiwire/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amnuts%2Fphpiwire/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263966172,"owners_count":23536814,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gpio","php","php-extension","raspberry-pi","raspberrypi","wiringpi","wiringpi-library","zephir"],"created_at":"2024-09-24T20:49:26.414Z","updated_at":"2025-07-06T20:05:52.809Z","avatar_url":"https://github.com/amnuts.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHPiWire\n\nA wrapper for [wiringPi](http://wiringpi.com/) written in [Zephir](http://www.zephir-lang.com/) so that is can be compiled as an extension for PHP.\n\n[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=acollington\u0026url=https://github.com/amnuts/phpiwire\u0026title=phpiwire\u0026language=\u0026tags=github\u0026category=software)\n\n## Requirements\n\nThis extension and the wiringPi library are intended to run on a RaspberryPi, so having a RaspberryPi is kind of a big requirement here!  You also need to have Git installed, the wiringPi library, various build tools and the php development headers.\n\n### Installing Git\n\n```\nsudo apt-get update\nsudo apt-get install git\n```\n\n### Installing wiringPi\n\n```\ngit clone git://git.drogon.net/wiringPi\ncd wiringPi\n./build\n```\n\nIf all goes well you should be able to run the gpio utility:\n\n```\ngpio -v\n```\n\nFull instructions for [installing wiringPi](http://wiringpi.com/download-and-install/).\n\n### Installing zephir\n\n```\nsudo apt-get install gcc make re2c php5 php5-json php5-dev libpcre3-dev\ngit clone https://github.com/phalcon/zephir\ncd zephir\n./install-json\n./install -c\n```\n\nIf all goes well you should be able to get the help info for zephir:\n\n```\nzephir help\n```\n\nFull instructions for [installing zephir](http://zephir-lang.com/install.html#installing-zephir).\n\n## Building the extension\n\n```\ngit clone https://github.com/amnuts/phpiwire\ncd phpiwire\nzephir build\n```\n\nThat will build and install the extension.  You'll then have to add the extension to your php.ini file.  You may find that you have two php.ini files, one for cli and one for web, so remember to add the extension to both.  You'll want to add the line:\n\n```\nextension=phpiwire.so\n```\n\nOnce this is done (and the web server restarted if you're adding the extension for web use and not just cli) you should be able to see the extension info when using the ```phpinfo()``` method or via the command line ```php -i```. \n\n## Example\n\nHere's a very simple example of how to make an LED attached to pin 0 (using the wiringPi pin numbering scheme, BCM_GPIO pin 17) blink on and off.\n\nAssuming the LED is attached as shown:\n\n![Overview](http://amnuts.com/images/phpiwire/blink1.jpg)\n\n```php\n\u003c?php\n\nnamespace Phpiwire;\n\nset_time_limit(0);\n\necho \"Raspberry Pi blink\\n\";\n\n$pi = new Board();\n$p = $pi-\u003egetPin(0)-\u003emode(Pin::OUTPUT);\n\nwhile (true) {\n    $p-\u003ewrite(Pin::HIGH);\n    sleep(1);\n    $p-\u003ewrite(Pin::LOW);\n    sleep(1);\n}\n```\n\nAnd to run it you'll need to be running as root:\n\n```\nsudo php blink.php\n```\n\n## Releases\n\nReleases of the extension are available at:\n\nhttps://github.com/amnuts/phpiwire/releases/\n\n## License\n\nMIT: http://acollington.mit-license.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famnuts%2Fphpiwire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famnuts%2Fphpiwire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famnuts%2Fphpiwire/lists"}