- Can I use ShipMonk Coding Standard in a Laravel project?
- No, this package is explicitly designed for non-Laravel PHP projects. Laravel relies on tools like Laravel Pint for Blade, Facades, and Eloquent conventions, which this package does not support. Using it could break Laravel-specific patterns or introduce formatting conflicts.
- How do I install ShipMonk Coding Standard?
- Run `composer require --dev shipmonk/coding-standard` in your project. Then create a `phpcs.xml.dist` file referencing the `ShipMonkCodingStandard` ruleset. The package provides a pre-configured setup for PHPCS and PHPCBF.
- Will this package conflict with Laravel Pint?
- Yes, using both in the same project is strongly discouraged. ShipMonk Coding Standard enforces ShipMonk-specific rules (e.g., annotation ordering, trait use), while Laravel Pint enforces Laravel’s conventions. Overlapping rules like array syntax or line breaks may cause inconsistencies or auto-fix conflicts.
- Does ShipMonk Coding Standard work with PHPStan or Rector?
- Some rules (e.g., `@template*` annotation ordering) may overlap with PHPStan’s checks, but this is intentional for ShipMonk’s consistency. However, auto-fixes like reordering `use` statements or traits could conflict with Rector transformations, potentially breaking Laravel’s Facade aliases or service provider bootstrapping.
- What PHP versions does this package support?
- ShipMonk Coding Standard requires PHP 8.1+ and officially supports up to PHP 8.5. If your project uses PHP 8.0 or earlier, you may need to adjust the ruleset or use a different package like `slevomat/coding-standard` for broader compatibility.
- How do I exclude Laravel-specific files from PHPCS?
- Modify your `phpcs.xml.dist` to exclude Laravel directories like `app/Http`, `resources/views`, or `routes/`. For example, add `<exclude-pattern>app/Http/.*</exclude-pattern>` to the ruleset. This allows selective enforcement for non-Laravel PHP files.
- Is this package actively maintained?
- The package is maintained by ShipMonk for their internal use, but it has minimal community adoption (0 dependents, 1 star). It’s not designed for heavy customization, so teams needing Laravel-specific rules should use `slevomat/coding-standard` or Laravel Pint instead.
- Can I customize the ShipMonk Coding Standard rules?
- The package is pre-configured for ShipMonk’s needs and lacks documentation for deep customization. If you require Laravel-specific rules (e.g., Blade template formatting, Eloquent method ordering), you’ll need to extend `slevomat/coding-standard` manually or use Laravel Pint.
- How do I integrate this into GitHub Actions or CI/CD?
- Add a step to run `vendor/bin/phpcs --standard=ShipMonkCodingStandard` in your CI pipeline. For auto-fixing, use `vendor/bin/phpcbf`. Ensure your workflow excludes Laravel-specific files or directories to avoid conflicts with Pint or Rector.
- What are the alternatives to ShipMonk Coding Standard for Laravel?
- For Laravel projects, use **Laravel Pint** for formatting (Blade, PHP) or **slevomat/coding-standard** for custom PHPCS rules. If you need ShipMonk’s specific rules in a hybrid project, apply this package *only* to non-Laravel directories (e.g., `app/Console`, `app/Jobs`) and exclude Laravel files.