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

Wordpress Globals Laravel Package

php-stubs/wordpress-globals

Stub declarations for WordPress globals like $wpdb, $post, and $wp_query, giving PHPStan, Psalm, and other static analyzers accurate types. Pairs with php-stubs/wordpress-stubs to silence undefined-variable warnings and improve autocompletion in plugin and theme code.

Deep Wiki
Context7

Product Decisions This Supports

  • Tooling/DevEx investment decision: whether to standardize static analysis (PHPStan/Psalm) across WordPress plugin and theme repos. This package is a supporting dependency that makes those gates practical by teaching the analyzer about WordPress globals and constants it can't otherwise resolve.
  • Build vs. buy: "buy" here is adopting a free, MIT-style OSS stub set instead of hand-maintaining a list of $wpdb, $post, WP_DEBUG, and dozens of other globals/constants in every repo. The build alternative is generating your own stubs and owning their drift forever — low value for a non-differentiating concern.
  • Feature/quality bar: lets you turn on "no undefined variable / undefined constant" rules without drowning in WordPress-specific false positives, which is the deciding factor for whether static analysis actually stays enabled in CI.
  • Roadmap sequencing: treat this as a low-priority, dev-only dependency to bundle with the main API stubs package (php-stubs/wordpress-stubs) rather than a standalone initiative. It is not a product capability; it's CI hygiene.
  • Use cases: WordPress plugins/themes with PHPStan or Psalm in CI, coding-standard enforcement in PRs, onboarding IDEs for new engineers, and auditing legacy code for typos in constant names that silently evaluate as truthy strings.

When to Consider This Package

  • Adopt when: your codebase targets WordPress and runs PHPStan/Psalm in CI; you already (or plan to) pull in php-stubs/wordpress-stubs; you want the global-variable/global-constant slice without committing generated stubs; and you're comfortable pinning a dev-only dependency that has no runtime footprint.
  • Adopt with caveats when: you're on a recent WordPress major. The last release is 2020-08-09, so newer core constants and globals may be absent — expect occasional ignoreErrors entries or a locally patched stub until upstream catches up.
  • Look elsewhere when: you need full WordPress API coverage (use wordpress-stubs, or a bundled solution like szepeviktor/phpstan-wordpress that wires stubs into PHPStan for you); you require an actively maintained dependency policy (13 stars and a 2020 release is a maintenance-risk signal); you're not doing static analysis at all (then it adds nothing); or you need runtime behavior (this package does nothing at runtime).
  • Defer when: the team hasn't yet adopted static analysis — introducing stubs before the analyzer creates dependency noise with no payoff.

How to Pitch It (Stakeholders)

For executives: this is a zero-cost, dev-only helper that makes our WordPress code-quality checks actually usable. It doesn't ship to production, adds no runtime risk, and its only job is to stop our static analysis from flagging WordPress's own globals and constants as errors. Net effect: fewer false alarms in code review, faster PR turnaround, and a real chance of catching typos in constant names that would otherwise fail silently.

For engineering: add it as a require-dev dependency alongside wordpress-stubs, pin the version, and let PHPStan/Psalm resolve $wpdb, $post, WP_DEBUG, and friends. Two caveats to own: it's a 2020 snapshot, so a handful of newer core constants may need suppression until upstream updates, and it is analysis-only — no runtime behavior, no production impact. If maintaining it becomes friction, the fallback is a bundled PHPStan WordPress extension that wraps the same stubs, at the cost of one more opinionated dependency.

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.
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels