This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is @platformatic/php - a PHP stackable for Watt that integrates PHP applications with the Platformatic framework. It enables serving PHP files through a Fastify server with proper request/response handling.
npm test- Run tests using Node.js built-in test runnernpm run build- Generate schema.json and config.d.ts from schema definitionsnpm run ci- Run linting and tests (assumes lint script exists)npm run dl-wordpress- Download WordPress for testing/development
The project follows Platformatic's stackable pattern:
- lib/index.js - Main stackable export with configuration and plugin registration
- lib/plugin.js - Fastify plugin that handles PHP request routing and execution
- lib/generator.js - Code generator for creating new PHP stackable projects
- lib/schema.js - JSON schema definitions for configuration validation
- Stackable Integration: Extends
@platformatic/servicewith PHP-specific functionality - Request Handling: All HTTP methods are captured by wildcard routes and forwarded to PHP via
@platformatic/php-node - Static File Serving: Non-PHP files in docroot are served statically with
@fastify/static - Header Processing: HTTP headers are capitalized for PHP compatibility
- Configuration Schema: Uses JSON schema with automatic TypeScript generation
When using the generator, projects include:
public/directory as PHP docroot withindex.phpplatformatic.jsonconfiguration file.envand.env.samplefor environment variables- Node.js v22.14.0+ requirement
- Uses Node.js built-in test runner (
node --test) - Tests cover generator functionality, configuration validation, and file generation
- Test fixtures in
test/fixtures/for integration testing