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

Php Code Style Laravel Package

jakub-onderka/php-code-style

A PHP coding style toolkit for consistent formatting and style enforcement across projects. Helps standardize code layout and conventions, making reviews easier and reducing style-related noise in diffs for teams and CI pipelines.

View on GitHub
Deep Wiki
Context7

jakub-onderka/php-code-style is a lightweight PHP package for applying a consistent code style across a project. It helps teams standardize formatting rules and reduce style-related noise in code reviews by providing a reusable configuration aligned with common community conventions.

Use it to keep PHP codebases clean and predictable, whether in standalone libraries or larger applications.

  • Provides a centralized coding standard configuration for PHP projects
  • Encourages consistent formatting to improve readability and maintainability
  • Helps reduce style-only diffs and streamline code reviews
  • Easy to integrate into existing development workflows and CI pipelines
Frequently asked questions about Php Code Style
Is jakub-onderka/php-code-style still maintained for Laravel 10+ projects?
No, this package hasn’t been updated since 2014 and lacks PHP 8.x or Laravel-specific support. It enforces PSR-1/PSR-2, which is outdated compared to PSR-12 (modern standard). For Laravel, use PHP-CS-Fixer or Laravel Pint instead.
Will this package break on PHP 8.x due to deprecated functions?
Yes, it likely will. The package relies on deprecated PHP 5.x/7.x features like `create_function`, which are removed in PHP 8.x. Test thoroughly or avoid it for modern PHP versions.
Can I integrate this into Laravel’s CI/CD pipeline for code style checks?
Yes, but manually. Add a GitHub Actions/GitLab CI step to run `vendor/bin/phpcs --standard=JakubOnderka/PHP_Code_Style`. However, it lacks native Laravel integration (e.g., Artisan commands) and may conflict with PHPStan/Psalm.
Does this package support Laravel-specific conventions (e.g., Blade templates, Eloquent naming)?
No, it only enforces generic PSR-1/PSR-2 rules. For Laravel, you’d need custom PHP_CodeSniffer rules or a hybrid setup with PHP-CS-Fixer, which supports Blade, Facades, and modern PHP features.
How does this compare to PHP-CS-Fixer for Laravel projects?
PHP-CS-Fixer is the modern alternative, actively maintained, and supports PSR-12 (Laravel’s default). It fixes code automatically, integrates with Laravel Pint, and works with PHP 8.x. This package is a legacy enforcer with no auto-fix capabilities.
Can I use this alongside Laravel Pint or PHPStan?
No, conflicts are likely. Pint enforces PSR-12, while this package enforces PSR-1/PSR-2. Running both may produce conflicting style rules. Choose one or use a hybrid approach (e.g., Pint for modern code, this package for legacy PSR-1/2).
What’s the best way to migrate from this package to PHP-CS-Fixer?
Replace it with `friendsofphp/php-cs-fixer` and configure PSR-12 rules. Run `php-cs-fixer fix` to auto-correct code. For Blade files, use the `--rules=@PSR12` preset. No manual migration is needed—just swap dependencies.
Are there false positives with Laravel’s snake_case vs. camelCase conventions?
Yes, this package’s PSR-1/PSR-2 rules may flag Laravel’s snake_case (e.g., `user_id`) as incorrect. Customize `phpcs.xml` or switch to PHP-CS-Fixer, which aligns better with Laravel’s conventions.
Does this package work with IDEs like PhpStorm or VSCode for real-time linting?
Yes, but with limitations. IDE plugins for PHP_CodeSniffer will use its rules, which may incorrectly flag modern Laravel patterns. For accurate linting, pair it with PHP-CS-Fixer or use Laravel Pint’s built-in IDE support.
Why would a Laravel team still use this package in 2024?
Only if enforcing PSR-1/PSR-2 for legacy reasons (e.g., compliance with an old standard). For new projects, use PHP-CS-Fixer or Pint. Existing teams might adopt it temporarily during a migration but should plan to replace it due to its lack of PHP 8.x and Laravel support.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport