- How do I install hypefactors/php-code-standards in a Laravel project?
- Install it with Composer as a development dependency, typically using composer require --dev hypefactors/php-code-standards. Then reference the provided ruleset in your project's phpcs.xml or phpcs.xml.dist. Keep it in require-dev because it is a coding standards tool, not runtime code. Verify the exact package name and version constraints on Packagist before installing.
- How do I run PHPCS with Hypefactors PHP Code Standards?
- After installation, run vendor/bin/phpcs against your source directories. Point PHPCS at your project ruleset, which should include the Hypefactors standard. Use options like --standard=Hypefactors or the path to the ruleset XML if documented. Review reported violations and fix them manually or with PHPCBF.
- Can PHPCBF automatically fix violations from this ruleset?
- Yes, PHPCBF can automatically fix many style violations reported by PHP_CodeSniffer. Run vendor/bin/phpcbf with the same standard and paths used for PHPCS. Always review changes and run tests afterward because not every violation is safely auto-fixable. Commit fixes separately for easier review.
- Is hypefactors/php-code-standards compatible with Laravel?
- It is a PHP coding standards package, so it can be used in Laravel projects as a development dependency. Compatibility depends on the PHP and PHP_CodeSniffer versions required by the package, not on a specific Laravel runtime version. Check the package constraints against your Laravel project's PHP version before adopting it. It does not add runtime Laravel features.
- How do I configure phpcs.xml to use Hypefactors coding standards?
- Create or edit phpcs.xml or phpcs.xml.dist in your project root and add a rule referencing the Hypefactors standard. The exact standard name or ruleset path depends on what the package provides, so confirm it in the package documentation. Include your app, routes, config, and tests directories as needed. Exclude generated or vendor directories to avoid noise.
- What is the difference between Hypefactors PHP Code Standards and Laravel Pint?
- Laravel Pint is Laravel's own opinionated PHP CS Fixer wrapper, while Hypefactors PHP Code Standards provides Hypefactors' shared ruleset for PHP_CodeSniffer and related tooling. Pint focuses on formatting fixes, whereas PHP_CodeSniffer can also detect broader coding standard violations. Choose the Hypefactors package when you need team-specific standards rather than Laravel's defaults. They can coexist, but avoid overlapping rules that fight each other.
- Can I customize the Hypefactors ruleset for my project?
- You can usually customize by creating your own phpcs.xml that includes the Hypefactors standard and then overrides or excludes specific sniffs. Keep local exceptions narrow so your codebase stays close to the shared standard. Document any deviations for the team. Check the package's README for the supported include syntax and standard name.
- How do I use this package in CI for Laravel projects?
- Add a CI step that installs Composer dependencies and runs vendor/bin/phpcs with your project ruleset. Fail the build on violations so style regressions are caught before merge. Cache Composer dependencies to speed up runs. Use the same PHP version in CI as your Laravel application to avoid false positives.
- Is hypefactors/php-code-standards a production dependency?
- No, coding standards tools should be installed as a development dependency because they are used for static checks and formatting, not at runtime. Keep it in require-dev and exclude it from production installs with composer install --no-dev. This keeps production deployments lean. The package does not need to be loaded by Laravel at runtime.
- Where can I find alternatives to Hypefactors PHP Code Standards?
- Common alternatives include Laravel Pint, PHP_CodeSniffer with other rulesets, and PHP CS Fixer configurations. If you want Laravel-specific defaults, Pint is often the first choice. If you need Hypefactors team conventions, use this package. Compare rule sets, PHP version support, and maintenance activity before switching.