- What is hostnet/phpcs-tool used for?
- It is a Composer package that provides a simple command-line wrapper around PHP_CodeSniffer. Use it to tokenise PHP, JavaScript, and CSS files and detect violations of a defined coding standard. In Laravel projects it helps enforce consistent style locally and in CI.
- How do I install hostnet/phpcs-tool in a Laravel project?
- Install it as a development dependency with Composer, typically using composer require --dev hostnet/phpcs-tool. Because it wraps PHP_CodeSniffer, it is usually run from vendor/bin or through a Composer script. Check the available binary after installation to confirm the exact command.
- How do I run PHP_CodeSniffer with hostnet/phpcs-tool?
- After installation, invoke the package's CLI wrapper from your project root, often via vendor/bin. Pass the paths you want to check, such as app, routes, and tests, along with your chosen standard or ruleset. Confirm the exact command name and options from the installed binary or package documentation.
- Does hostnet/phpcs-tool work with Laravel?
- It is not Laravel-specific; it is a wrapper for PHP_CodeSniffer, so it can run in any PHP project. In Laravel you can point it at app, config, routes, tests, and other directories and use a Laravel-friendly ruleset. It works well as a local quality check and as a CI step.
- Which Laravel or PHP versions are supported by hostnet/phpcs-tool?
- The package is installed via Composer, so compatibility is determined by its composer.json constraints and the PHP_CodeSniffer version it pulls in. Check those constraints against your Laravel project's PHP version before installing. For older Laravel applications, verify that the required PHP version is still supported.
- Can I use a custom coding standard or ruleset with hostnet/phpcs-tool?
- PHP_CodeSniffer supports custom rulesets via XML files, and a wrapper generally lets you pass a standard or ruleset path. Create a ruleset for your Laravel conventions and reference it in local and CI commands. Confirm the wrapper's exact option for ruleset selection in its documentation.
- Can hostnet/phpcs-tool check JavaScript and CSS files?
- The underlying PHP_CodeSniffer tool tokenises PHP, JavaScript, and CSS files, so it can detect violations in those file types when configured. In a Laravel project you may still prefer separate JavaScript and CSS linters, but PHPCS can cover basic style checks. Point the command at the relevant directories or file extensions.
- How do I integrate hostnet/phpcs-tool into a CI pipeline?
- Add the Composer install and the PHPCS wrapper command to your CI pipeline, typically as a dedicated lint or static analysis job. Configure it to fail on violations so pull requests cannot merge with style errors. Cache Composer dependencies if your CI provider supports it.
- What is the difference between hostnet/phpcs-tool and squizlabs/php_codesniffer?
- squizlabs/php_codesniffer is the underlying PHP_CodeSniffer library and CLI. hostnet/phpcs-tool is a Hostnet wrapper that provides a simpler command-line entry point around it. Use the wrapper if you want the Hostnet workflow; use PHP_CodeSniffer directly if you need its full native CLI surface.
- Is hostnet/phpcs-tool maintained, and what should I check before using it in production?
- Maintenance activity and release compatibility should be verified on Packagist and the repository before adopting it. Check the latest release date, supported PHP versions, and whether it tracks current PHP_CodeSniffer releases. For production use, pin the version in composer.json and run it in CI so style checks are reproducible.