artisanpack-ui/code-style
A custom PHP_CodeSniffer standard for ArtisanPack UI projects, with 16+ sniffs enforcing consistent formatting, naming, security, and best practices. Install via Composer, add a phpcs.xml ruleset, and run phpcs to check your code.
phpcs.xml, one CI job. Shifts review feedback from subjective style arguments to actual design discussion.die/exit/var_dump/print_r in production paths are recurring defect sources, a lint gate is a low-cost, non-architectural fix that doesn't compete with feature work.Treat the house-style choices — tabs, spaces inside parentheses (if ( $condition )), Yoda conditionals, uppercase magic methods (__CONSTRUCT()) — as brand/team preference decisions, not quality decisions. They are the package's identity and its adoption friction in equal measure.
What's genuinely differentiated, and worth valuing separately from the cosmetics:
TypeDeclaration sniff that skips property checks for Model classes and Models directories. Generic PSR-12 rulesets get this wrong and produce noise developers learn to ignore.ArtisanPackUI.Formatting.Indentation with an indent property), which makes partial or tuned adoption technically feasible.Adopt when:
Look elsewhere when:
LineLength is explicitly disabled, and formatting is a commodity better served by a maintained tool.Adoption criteria before committing: pinned version, a CI job that actually fails the build, a documented migration PR, a named owner, and an escape hatch — rule-level exclude entries for legacy code you won't fix this quarter.
Executives. A single MIT-licensed dev dependency that turns "our code style" into something CI enforces, instead of a document nobody reads. The cost is one line in composer.json and one CI step; the return is fewer review cycles burned on nitpicks and less drift across repos and contractors. The risk is concentration: this is a small, near-zero-adoption project. Frame it as an internal convention with a fork option, not a strategic platform bet — and budget the fork cost if it goes org-wide.
Engineering. A PHPCS ruleset with 16+ custom sniffs spanning formatting, code structure, naming, type declarations, import ordering, class structure, disallowed functions, and security checks. It's Laravel-aware — TypeDeclaration skips property-type checks in Models so it won't fight Eloquent. Every sniff is overridable via phpcs.xml properties, so indentation width and rule selection are tunable. Requires PHP 8.2+.
The caveat to lead with, not bury. This is an opinionated house style, not a community standard. Tabs, space-inside-parens, Yoda conditionals, and uppercase magic methods will be contentious in review, and they diverge from PSR-12 and Pint. Recommended path: pilot on one internal repo with a timeboxed migration PR, measure how many violations are autofixable vs. manual, then decide. Do not apply it to repos where outside contributors or PSR-12 compliance matter — the friction there outweighs the benefit.
How can I help you explore Laravel packages today?