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

Wpcs Laravel Package

wp-coding-standards/wpcs

WordPress Coding Standards for PHP_CodeSniffer (WPCS) provides PHPCS rulesets and sniffs to enforce WordPress PHP style, best practices, security, and documentation guidelines. Install via Composer and run PHPCS to lint WordPress themes, plugins, and projects.

View on GitHub
Deep Wiki
Context7

Getting Started

Install the package via Composer as a dev dependency: composer require --dev wp-coding-standards/wpcs:^3.0. The package auto-registers with PHP_CodeSniffer via the Composer PHPCS plugin. Run checks using vendor/bin/phpcs --standard=WordPress path/to/code. Start with the WordPress standard (includes all sniffs), then consider narrowing to WordPress-Core, WordPress-Docs, or WordPress-Extra as needed. For most teams, using --standard=WordPress with CI integration is the minimal viable first step.

Implementation Patterns

Integrate WPCS early into your development workflow: configure a phpcs.xml.dist file in your project root to define your ruleset, ignore paths (e.g., vendor/), and sniff-specific settings (e.g., custom path prefixes). Use --encoding=utf-8 for multibyte-safe analysis and pipe output to tools like phpcs-reporter for reports. In CI, run on pull requests using GitHub Actions or similar with a matrix build (e.g., PHP 7.2–8.5) to catch compatibility issues. Combine with PHPCompatibilityWP for cross-PHP-version checks, and configure VariableAnalysis to detect undefined/unused variables. For IDE integration, use VS Code + PHP CS Fixer or PHPStan extensions configured to point to vendor/bin/phpcs.

Gotchas and Tips

  • Global installs are deprecated: Only Composer-based installs (project or global via composer global) are officially supported since v3.0—avoid PHAR or PEAR.
  • Path resolution quirks: Relative paths in phpcs.xml are resolved from the file’s directory, not where you run the command—use absolute paths for consistency in CI.
  • Autoload issues: If sniffs aren’t discovered, clear PHPCS cache: phpcs -i to list installed standards; if missing, run composer dump-autoload.
  • Customization landmines: Some sniffs (e.g., WordPress.NamingConventions.ValidFunctionName) are highly configurable but undocumented in the main README—check the wiki page for customizable sniff properties for overrides.
  • Escaping assumptions: WPCS enforces contextual escaping (e.g., esc_html(), esc_attr()) but doesn’t catch edge cases like wp_kses_post() misuse—combine with static analysis (e.g., PHPStan) for full coverage.
  • Performance tips: Use --parallel=8 to speed up large codebases, and exclude heavy sniffs (e.g., WordPress.WhiteSpace.PostConditionSpaces) in CI if latency is critical—re-enable selectively during PR reviews.
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