The PHP runner in Chase provides automated autoloading, include path management, and PHPUnit integration.
Chase identifies a PHP project if any of the following files are found in the project root:
composer.jsoncomposer.lockartisanphpunit.xmlphpunit.xml.distvendor/autoload.php
When you press <leader>cc:
- Inside a Test:
- Uses Tree-sitter to detect
PHPUnit\Framework\TestCaseclasses and methods. - Command:
vendor/bin/phpunit --filter "ClassName::methodName" <file>
- Uses Tree-sitter to detect
- Outside a Test:
- Command:
php -d include_path='.:/project/root' -d auto_prepend_file='/project/root/vendor/autoload.php' <file>
- Command:
- Autoloading:
- Automatically prepends
vendor/autoload.phpto any executed script if it exists. - Adds the project root to the PHP
include_path.
- Automatically prepends
require("chase").setup({
php = {
enabled = true,
include_path = { "." },
},
})