rgb72 / coding-standards
Shared PHP CS Fixer config and EditorConfig for rgb72 Laravel projects
Requires
- php: ^8.2
- friendsofphp/php-cs-fixer: ^3.64
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-21 00:21:35 UTC
README
Shared code style for rgb72 projects — Laravel (PHP CS Fixer) and Vue 3 + Vuetify on Nuxt or Laravel + Vite/Inertia (ESLint, Prettier, Stylelint), plus a common .editorconfig.
| Tool | Package | Import |
|---|---|---|
| Prettier | @rgb72/coding-standards (npm) | @rgb72/coding-standards/prettier |
| ESLint | @rgb72/coding-standards (npm) | @rgb72/coding-standards/eslint |
| Stylelint | @rgb72/coding-standards (npm) | @rgb72/coding-standards/stylelint |
| PHP CS Fixer | rgb72/coding-standards (Composer) | Rgb72\CodingStandards\PhpCsFixer\Config |
| EditorConfig | both | copied by rgb72-standards init |
Frontend (Nuxt or Laravel + Vite)
# Nuxt (requires @nuxt/eslint)
npm i -D @rgb72/coding-standards eslint prettier stylelint
npx rgb72-standards init --nuxt
# Laravel + Vite / Inertia / Vuexy
npm i -D @rgb72/coding-standards eslint prettier stylelint eslint-plugin-vue typescript-eslint
npx rgb72-standards init --vite
Creates .editorconfig, eslint.config.mjs, prettier.config.mjs, stylelint.config.mjs and .prettierignore. Existing files are skipped (--force to overwrite), and legacy configs (.prettierrc, .eslintrc.cjs, .stylelintrc.json) are reported so you can delete them — Prettier picks .prettierrc over prettier.config.mjs if both exist.
Style at a glance
- No semicolons, single quotes, trailing commas,
printWidth: 120, 2-space indent (4 for PHP) - One attribute per line in templates
- Imports sorted by
@ianvs/prettier-plugin-sort-imports: types → built-ins/packages →@/aliases →@/*.vuecomponents → relative - Vuetify components in PascalCase (
<VBtn>),<script setup>only, block order script → template → style - SCSS: idiomatic property order, logical properties (
margin-inlinenotmargin-left)
Vuexy projects
Keep Vuexy-only rules in the project, not here: path-alias importOrder (example in the prettier.config.mjs stub), regex/invalid alias rules, valid-appcardcode-*, and no-restricted-imports for auto-imported packages. Add them to the project block of eslint.config.mjs.
Laravel
PSR-12 base, declare(strict_types=1), short arrays, 'Hello ' . $name concat spacing, sorted/unused imports cleaned, Laravel-style ! $x.
composer require --dev rgb72/coding-standards
vendor/bin/rgb72-standards init
vendor/bin/php-cs-fixer fix
// .php-cs-fixer.dist.php
use Rgb72\CodingStandards\PhpCsFixer\Config;
return Config::make(
Config::laravelFinder(__DIR__),
['final_class' => true], // optional project overrides
);
Suggested composer.json scripts:
"scripts": {
"lint": "php-cs-fixer fix --dry-run --diff",
"fix": "php-cs-fixer fix"
}
Developing locally
Link the working copy into a project instead of publishing:
# Nuxt
npm i -D ~/Workspace/Libraries/coding-standards
// Laravel composer.json
"repositories": [
{ "type": "path", "url": "~/Workspace/Libraries/coding-standards", "options": { "symlink": true } }
]
Run tests with npm test.
Releasing
- Update
versioninpackage.jsonandCHANGELOG.md git flow release start 1.2.0, commit, thengit flow release finish 1.2.0 -m "release: 🏹1.2.0"(tagv1.2.0)git push origin main develop --follow-tags- GitLab CI publishes to npm on the
v*tag (Trusted Publishing, OIDC — no token); Packagist updates via the GitLab integration
See CHANGELOG.md for the semver policy.