Weave 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
Php Code Style

Php Code Style Laravel Package

longman/php-code-style

longman/php-code-style gives Laravel and PHP projects an opinionated, ready-to-use code style setup, bundling fixer rules and configs so teams can enforce consistent formatting and catch style issues with minimal effort.

View on GitHub
Deep Wiki
Context7

longman/php-code-style is an opinionated PHP-CS-Fixer configuration package that gives your projects a consistent, battle-tested coding standard out of the box. Install it via Composer and extend the provided config to enforce the same style across all your PHP and Laravel codebases—no rule-by-rule setup required.

  • Ships a ready-made PHP-CS-Fixer ruleset
  • One-line setup by extending the provided config
  • Keeps style consistent across multiple projects
  • Works with Laravel and plain PHP packages
  • Customisable: add or override rules per project
Frequently asked questions about Php Code Style
What is longman/php-code-style and what does it do?
longman/php-code-style is a set of opinionated coding-standard configuration files, primarily PHPCS-oriented, that you point your linter at to enforce consistent formatting. It ships no runtime application code and does not register a Laravel service provider, so it never loads in production. Think of it as a reference ruleset rather than a library.
How do I install longman/php-code-style in a Laravel project?
You can pull it in with composer require --dev longman/php-code-style, but most teams should instead copy the ruleset into a committed phpcs.xml.dist or pint.json. Because the last release was June 2017, adding it as a floating dev dependency risks rule names that no longer resolve in current PHP_CodeSniffer versions. Vendor or transcribe the config and pin your formatter to an exact version.
Does longman/php-code-style work with Laravel and current Laravel versions?
The ruleset is framework-agnostic, so it applies to Laravel projects as well as plain PHP codebases, but it has no awareness of Laravel-specific conventions. It predates Laravel Pint and the PSR-12 era, so its defaults may conflict with modern Laravel style. For current Laravel versions, use Pint with a pint.json and treat this package as a source of rule intent.
Which tool does longman/php-code-style target, PHP_CodeSniffer or PHP-CS-Fixer?
The overview describes it as PHPCS-oriented configuration, meaning it is intended for PHP_CodeSniffer rather than PHP-CS-Fixer, though you should inspect the repository to confirm exactly which files and sniff codes it ships. Rule naming differs significantly between PHP_CodeSniffer 2.x and 3.x, and between PHP-CS-Fixer 2.x and 3.x. Validate every rule against the engine version your team runs before enforcing it.
Is longman/php-code-style still maintained and safe to use?
No, upstream is effectively dormant: the last release was June 2017 and the package has no dependents providing a validation signal. There is low security risk because it ships no executable runtime code, so the CVE surface is minimal. The real risk is tool drift causing CI hard failures or false positives on modern syntax.
Does longman/php-code-style support PHP 8 syntax like enums, readonly properties and attributes?
Almost certainly not out of the box. A 2017-era ruleset predates enums, readonly properties and classes, constructor property promotion, attributes, and first-class callables, so it may under-cover them or actively reject valid PHP 8.x code. You will need to add modern-syntax exemptions and align with PSR-12. Gate adoption on your team's PHP version floor.
Should I add longman/php-code-style to require-dev or vendor the config?
Do not add it to require-dev as a floating dependency. Vendor the relevant config into the repository root or a tools/style directory and commit it so the standard is versioned with the code it governs. Pin the formatter itself, such as php-cs-fixer/shim or laravel/pint, to an exact release for deterministic CI.
How do I adopt longman/php-code-style in CI without breaking the build?
Run the config in report-only mode across the default branch first to quantify violation volume. Decide up front whether you will reformat or grandfather existing files, then land one mechanical reformat commit and register it in .git-blame-ignore-revs. Wire the formatter into pre-commit hooks as advisory and promote CI to blocking only after the baseline commit is merged.
What are good alternatives to longman/php-code-style for Laravel code style enforcement?
For Laravel shops the pragmatic choice is Laravel Pint, a PHP-CS-Fixer wrapper configured with pint.json. Non-Laravel projects can use PHP-CS-Fixer with the @PSR12 ruleset or PHP_CodeSniffer with PSR-12 and Slevomat sniffs. Easy Coding Standard is another maintained option if you want a single tool for both linting and formatting.
How do I keep IDE formatting in sync with longman/php-code-style rules?
Keep IDE auto-format parity with CI by configuring PhpStorm, or your editor of choice, to use the same formatter binary and ruleset version as the pipeline. Without that parity, developers get diff churn and reformat-only commits that obscure real changes. Pin the tool version in both places and document the inline-ignore and escalation path.
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.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo