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

Phpcsdevcs Laravel Package

phpcsstandards/phpcsdevcs

phpcsdevcs provides a set of PHP_CodeSniffer rules and configuration to enforce consistent coding standards across PHP projects. Drop-in standards for PHPCS with sensible defaults, helping teams catch style issues early and keep code clean and uniform.

View on GitHub
Deep Wiki
Context7

PHPCSDevCS for developers of PHP_CodeSniffer sniffs

Latest Stable Version Release Date of the Latest Version :construction: Latest Unstable Version Build Status Last Commit to Unstable

Minimum PHP Version License: LGPLv3 Awesome

This is an external ruleset for PHP CodeSniffer intended for use by sniff developers.

Installation

Composer Project-based Installation

Run the following from the root of your project:

composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer require --dev phpcsstandards/phpcsdevcs:"^1.0"

Composer Global Installation

If you work on several different sniff repos, you may want to install this toolset globally:

composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer global require --dev phpcsstandards/phpcsdevcs:"^1.0"

Composer will automatically install dependencies and register the PHPCSDev and other external standards with PHP_CodeSniffer using the Composer PHPCS plugin.

PHPCSDev ruleset for sniff repos

Once this project is installed, you will see a new PHPCSDev ruleset in the list of installed standards when you run phpcs -i.

Important: This ruleset currently requires PHP_CodeSniffer >= 3.13.0+.

As sniffs developers will mostly work with the latest version of PHP_CodeSniffer, this shouldn't cause any problems.

Similarly, the CS check in automated CI runs should normally be run on a high PHPCS version for the best results.

The PHPCSDev standard can be used by sniff developers to check the code style of their sniff repo code.

Often, sniff repos will use the code style of the standard they are adding. However, not all sniff repos are actually about code style.

So for those repos which need a basic standard which will still keep their code-base consistent, this standard should be useful.

The standard checks your code against the following:

  • Compliance with PSR-12, with a few exceptions.
  • Use of camelCase variable and function names.
  • Use of normalized arrays.
  • All files, classes, functions and properties are documented with a docblock and contain the minimally needed information.
  • A number of arbitrary additional code style and QA checks.
  • PHP cross-version compatibility, while allowing for the tokens back-filled by PHPCS itself. Note: for optimal results, the project custom ruleset should set the testVersion config variable. This is not done by default as config variables are currently difficult to overrule.

The ruleset can be used like any other ruleset and specific sniffs and settings can be added to or overruled from a custom project based ruleset.

Using the ruleset from the command line

phpcs . --standard=PHPCSDev

Using the ruleset from within a project based ruleset

Add the following line to your project's phpcs.xml.dist file:

<rule ref="PHPCSDev"/>

Contributing

Contributions to this project are welcome. Just clone the repo, branch off from main, make your changes, commit them and send in a pull request.

If unsure whether the changes you are proposing would be welcome, open an issue first to discuss your proposal.

License

This code is released under the GNU Lesser General Public License (LGPLv3). For more information, visit http://www.gnu.org/copyleft/lesser.html

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.
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
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