php/.claude-plugin/scripts/php-format.sh
Snider 4b24a6d186
Some checks failed
CI / PHP 8.4 (push) Failing after 1m51s
CI / PHP 8.3 (push) Failing after 2m4s
feat: add claude plugin for PHP/Laravel development
Skills: php, php-agent, laravel
API: route generation (TS/JS/OpenAPI from Laravel routes)
Hooks: auto-format PHP with Pint, debug statement warnings
2026-03-09 18:15:42 +00:00

17 lines
492 B
Bash
Executable file

#!/bin/bash
# Auto-format PHP files after edits using core php fmt
read -r input
FILE_PATH=$(echo "$input" | jq -r '.tool_input.file_path // empty')
if [[ -n "$FILE_PATH" && -f "$FILE_PATH" ]]; then
# Run Pint on the file silently
if command -v core &> /dev/null; then
core php fmt --fix "$FILE_PATH" 2>/dev/null || true
elif [[ -f "./vendor/bin/pint" ]]; then
./vendor/bin/pint "$FILE_PATH" 2>/dev/null || true
fi
fi
# Pass through the input
echo "$input"