flavioheleno / pastry
A Raspberry Pi Information Library
Fund package maintenance!
Patreon
Requires
- php: >=7.4
Requires (Dev)
- infection/infection: ^0.26
- php-parallel-lint/php-parallel-lint: ^1.3
- phpstan/phpstan: ^1.4
- phpunit/phpunit: ^9.5
- psy/psysh: ^0.11
- roave/security-advisories: dev-latest
- squizlabs/php_codesniffer: ^3.6
- vimeo/psalm: ^4.8
This package is auto-updated.
Last update: 2024-11-25 02:24:53 UTC
README
Pastry is a handy tool to extract information from your Raspberry Pi.
Installation
To use Pastry, simple run:
composer require flavioheleno/pastry
Usage
The Pastry library is super straightforward to use.
/* Probe the system for information */ $pi = Pastry\Pi::probe(); /* Board details */ $board = $pi->getBoard(); $board->getHardware(); // string(7) "BCM2711" $board->getRevision(); // string(6) "d03114" $board->getSerial(); // string(16) "xxxxxxxxxxxxxxxx" $board->getModel(); // string(30) "Raspberry Pi 4 Model B Rev 1.4" /* CPU details */ $cpu = $pi->getCpu(); $cpu->getCount(); // int(4) $cpu->getModelName(); // string(27) "ARMv7 Processor rev 3 (v7l)" $cpu->getBogoMips(); // float(108) $cpu->getFeatures(); // array(15) { // [0] => string(4) "half" // [1] => string(5) "thumb" // [2] => string(8) "fastmult" // [3] => string(3) "vfp" // [4] => string(4) "edsp" // [5] => string(4) "neon" // [6] => string(5) "vfpv3" // [7] => string(3) "tls" // [8] => string(5) "vfpv4" // [9] => string(5) "idiva" // [10] => string(5) "idivt" // [11] => string(6) "vfpd32" // [12] => string(4) "lpae" // [13] => string(7) "evtstrm" // [14] => string(5) "crc32" // } $cpu->getImplementer(); // int(65) $cpu->getArchitecture(); // int(7) $cpu->getVariant(); // int(0) $cpu->getPart(); // int(3336) $cpu->getRevision(); // int(3) /* Revision details */ $revision = $pi->getRevision(); $revision->getReleaseDate(); // string(7) "Q2 2020" $revision->getOvervoltage(); // int(0) - Overvoltage allowed $revision->getOtpProgram(); // int(0) - OTP programming allowed $revision->getOtpRead(); // int(0) - OTP reading allowed $revision->getWarranty(); // int(0) - Warranty is intact $revision->getNewFlag(); // int(1) - new-style revision $revision->getMemorySize(); // int(5) - 8GB $revision->getManufacturer(); // int(0) - Sony UK $revision->getProcessor(); // int(3) - BCM2711 $revision->getType(); // int(17) - 4B $revision->getPcbRevision(); // float(1.4)
Supported Hardware
The table below lists the tested chips.
If you have a Raspberry Pi and you don't see its model revision listed here, please consider contributing the contents of your /proc/cpuinfo
.
License
This library is licensed under the MIT License.