QR Inventory/Asset tracking system for SBC.
It uses PHP, CSS, JavaScript, MariaDB.
See .agentic.yml and .agentic.workflow.yml for project rules.
git clone git@github.com:SBCLockDevTeam/Inventory.git /var/www/html/sbcqr/qr/Copy the secrets template and fill in your database credentials:
cp /var/www/html/sbcqr/qr/config/secrets.php.example /var/www/html/sbcqr/qr/config/secrets.phpThen edit /var/www/html/sbcqr/qr/config/secrets.php and enter your database password and any other environment-specific credentials.
⚠️ secrets.phpis excluded from Git and must be created manually on every server.
The application includes a compiled C helper (bin/printer) for sending ESC/P label jobs to a network printer over TCP. This binary is not stored in Git (it is platform-specific) and must be compiled on each server after cloning.
Why it exists: PHP's fsockopen() had intermittent hostname resolution failures on some server configurations. This compiled helper bypasses that issue.
To compile:
gcc -o /var/www/html/sbcqr/qr/bin/printer /var/www/html/sbcqr/qr/bin/printer.cNo special libraries are required — only standard gcc and POSIX system libraries (available on any standard Linux server).
To verify it compiled correctly:
/var/www/html/sbcqr/qr/bin/printerYou should see: Usage: printer <host> <port>
Usage: The binary reads a raw ESC/P payload from stdin and sends it to the printer at <host>:<port> over TCP. It accepts
both hostnames and IP addresses.
Brother TD-4D Printer:
The Brother TD-4420DN uses ESC/P commands. AI agents will often removed the required initialization code. The fault is not intermittent: after a power cycle, the printer won’t work until it’s initialized. Once initialized, it prints reliably. Best practice: send the init sequence at the start of every print job.
chmod +x /var/www/html/sbcqr/qr/bin/printer| Dependency | Version | Notes |
|---|---|---|
| PHP | 7.4+ | |
| MariaDB | 10.x+ | Database: SBCInv |
| Apache | 2.4+ | Document root: /var/www/html/sbcqr/ |
| gcc | Any modern | Required to compile bin/printer.c |
/qr/
├── /assets/ # Images and media
├── /bin/ # Compiled binaries (built on server, not tracked in Git)
│ ├── printer.c # Source code for printer helper (tracked in Git)
│ └── printer # Compiled binary (NOT tracked in Git — compile from printer.c)
├── /config/ # Configuration files
│ ├── secrets.php # NOT tracked in Git — create from .example
│ └── secrets.php.example # Template — tracked in Git
├── /css/ # Stylesheets
├── /js/ # JavaScript
├── /lib/ # PHP utility/helper functions
├── /templates/ # HTML templates (header, footer, menu, etc.)
└── /uploads/ # User-uploaded files (not tracked in Git)
- AI writes changes to Git (
mainbranch) first. - User pulls changes to the server after.
- Never commit
config/secrets.phpor the compiledbin/printerbinary. - Work on
mainbranch only — no pull requests.