Aug 2024Open Source1 min read

PHP Ghost Wall

On shared hosting nothing notices when a deployed file is quietly changed. I published a Composer package that hash-checks a monitored file on every Laravel boot and sends a tamper alert, with server details, the moment it differs.

Laravel boot-time SHA-256 file integrity check and server phone-home for shared hosting

PHP / Laravel / Packagist

What it does

On every Laravel boot, PhpGhostWallServiceProvider (via booted):

  1. Integrity check: SHA-256 of a configured path vs an expected hash in .env
  2. Tamper alert: webhook POST when the hash mismatches
  3. Phone-home: on a clean check, send domain, IP, PHP/Laravel versions, and git rev-parse HEAD

Built for environments where you cannot install a file-integrity daemon or rely on CI watching the server: the same constraint that showed up shipping the school CMS on shared hosting.

Install

composer require vishalxtyagi/php-ghost-wall
php artisan vendor:publish --provider="Vishalxtyagi\PhpGhostWall\PhpGhostWallServiceProvider"

Configure paths and endpoints in .env (INTEGRITY_MONITOR_*).

Design notes

  • Singleton via the service container; booted() runs after other providers so HTTP facades are available.
  • Monitored path is configurable (originally AppServiceProvider.php as a common injection target).
  • Skipping TLS verification on the alert POST was a pragmatic shared-hosting choice: treat that as a known tradeoff, not a general security recommendation.

What it demonstrates

  • Shipping a Packagist package for a real ops constraint
  • Boot-time integrity as a substitute when you lack host-level watchers
  • Keeping the surface small: one provider, env config, webhook side effects