Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Mo4 Coding Standard

Mo4 Coding Standard Laravel Package

mayflower/mo4-coding-standard

PHP_CodeSniffer ruleset implementing the MO4 coding standard. Extends Symfony’s standard with extra sniffs for array formatting and alignment, multiline arrays, property docblock @var rules, and lexicographically sorted use statements (configurable ordering).

View on GitHub
Deep Wiki
Context7

PHP CodeSniffer ruleset implementing the MO4 coding standards extending the Symfony coding standards.

Frequently asked questions about Mo4 Coding Standard
How do I install MO4 Coding Standard in my Laravel project?
Run `composer require --dev mayflower/mo4-coding-standard` in your project directory. No additional setup is needed beyond configuring PHP_CodeSniffer to use the MO4 standard in your `.phpcs.xml` or `phpcs.xml.dist` file.
Does this package work with Laravel 10+?
Yes, MO4 Coding Standard requires PHP 8.1+, which aligns with Laravel 10+'s PHP version requirements. It’s fully compatible with modern Laravel projects.
Can I use MO4 alongside PSR12 in Laravel?
Yes, but you’ll need to configure PHP_CodeSniffer to prioritize MO4 rules where needed. Some rules (e.g., array alignment) may conflict with PSR12, so test thoroughly or disable redundant rules in `ruleset.xml`.
How do I configure use statement sorting order?
Edit your `phpcs.xml` or `ruleset.xml` to specify the `order` property for `MO4.Formatting.AlphabeticalUseStatements`. Options include `locale`, `string-locale`, or custom dictionaries. Example: `<arg name="order" value="string-locale"/>`.
Will this break my existing Laravel codebase?
It depends on your current coding style. Run `vendor/bin/phpcs --standard=MO4 --report=full app/` first to identify violations. Use `phpcbf` for auto-fixing supported rules, but review changes manually for Laravel-specific patterns (e.g., Blade templates).
Can I exclude Blade templates or migrations from MO4 checks?
Yes, configure exclusions in your PHP_CodeSniffer config. Example: `<file>app/</file><exclude name="app/Views"/><exclude name="database/migrations"/>` to skip Blade and migrations.
How do I integrate MO4 into GitHub Actions for CI?
Add a step to your workflow like this: `- name: Run MO4 Coding Standard run: vendor/bin/phpcs --standard=MO4 --warning-severity=9 --error-severity=9 app/`. Treat violations as errors (`--error-severity=9`) to block PRs or warnings (`--warning-severity=9`) for gradual adoption.
Are there Symfony-specific rules I should disable for Laravel?
Yes, disable redundant Symfony rules like `Symfony2.Arrays.TrailingComma` if they conflict with Laravel conventions. Use `<rule ref="Symfony" />` in your `ruleset.xml` and exclude specific rules with `<exclude name="Symfony2.Arrays.TrailingComma" />`.
Does MO4 support auto-fixing (phpcbf) for Laravel code?
Most rules support auto-fixing via `phpcbf`. Run `vendor/bin/phpcbf --standard=MO4 app/` to fix alignable arrays, use statements, and docblocks. Test in a staging environment first, as some Laravel-specific patterns (e.g., dynamic Blade strings) may not auto-fix cleanly.
What alternatives exist for Laravel coding standards?
Alternatives include `phpcs-standard` (PSR12), `dealerdirect/phpcodesniffer-composer-normalize`, or custom rulesets. MO4 is unique for its Symfony extension (e.g., strict docblocks, array alignment) and configurability, making it ideal for projects using Symfony components alongside Laravel.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope