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
Phpstorm Stubs

Phpstorm Stubs Laravel Package

jetbrains/phpstorm-stubs

Official JetBrains stubs provide syntactically correct PHP function and class signatures, constants, and detailed PHPDoc for built-in PHP and most standard extensions. They power IDE completion, code inspection, type inference, and documentation popups in PhpStorm and other tools.

View on GitHub
Deep Wiki
Context7

phpstorm-stubs provides syntactically valid PHP stub files with function and class signatures, constant definitions, and complete PHPDoc for built-in PHP and most standard extensions. These stubs power IDE code completion, inspection, type inference, and doc popups, so annotation quality matters.

Non-standard extension stubs are community-driven and validated only for PHPDoc correctness. Point PhpStorm’s default stubs path at the repository for easy two-way Git updates.

  • Complete signatures and constants for PHP core and bundled extensions
  • Rich PHPDoc annotations, especially @return
  • Better completion, inspection, and type inference
  • Community-maintained non-standard extension stubs
  • Simple IDE integration and contribution workflow
Frequently asked questions about Phpstorm Stubs
What is jetbrains/phpstorm-stubs and what does it actually do?
It is JetBrains' official collection of syntactically valid PHP stub files that declare signatures, constants, and PHPDoc for PHP core, bundled extensions, and many PECL extensions. It is not application code and contains no runtime logic. IDEs and static analyzers read the stubs to power completion, inspections, type inference, and documentation popups. In a Laravel project it belongs in require-dev only.
Do I need to install jetbrains/phpstorm-stubs if PhpStorm already bundles stubs?
Usually not. PhpStorm ships with stubs generated from this same repository, so installing the Composer package without explicitly pointing the IDE at it produces no benefit at all. The package only adds value when you want a newer stub set than your IDE build includes, or you need signatures for an extension your IDE does not cover. Capture a baseline of your current inspection errors before adding it so you can prove any improvement.
How do I install jetbrains/phpstorm-stubs in a Laravel project?
Run composer require --dev jetbrains/phpstorm-stubs. Because it is a dev dependency it is skipped by composer install --no-dev, so it never reaches your production images or deploy artifacts. Do not add it to require, and do not let it into any classmap or autoload configuration. If you are on a shared repo, confirm your .gitignore already excludes vendor.
How do I configure PhpStorm to use the Composer-installed stubs?
Open Settings, then Languages and Frameworks, then PHP, then PHP Runtime, and go to Advanced settings. Set the Default stubs path to the vendor/jetbrains/phpstorm-stubs directory and let the IDE reindex. Without that explicit path change the package is inert. You can point it at a cloned git checkout instead if you want to update the stubs with normal git commands.
Does jetbrains/phpstorm-stubs help PHPStan or Larastan?
Only marginally, because PHPStan ships its own php-8-stubs packages and Psalm maintains its own call map. Adding these stubs via stubFiles in phpstan.neon is justified only when a signature is missing from the built-in set, typically for a PECL extension or a very new PHP version. Adding overlapping stubs can produce duplicate declarations or spurious findings. Measure PHPStan results before and after rather than assuming an improvement.
Will the stubs cause duplicate declaration errors or autoload conflicts?
They can if they leak into autoloading, classmap generation, or a static analyzer's scan paths, because the files declare functions and classes that also exist natively in PHP. Exclusion has to be deliberate rather than incidental. Keep the package out of composer autoload sections and out of any path scanned as application source. The IDE and analyzers should consume them only as a dedicated stub path.
Which extensions are covered, and are the PECL stubs like Redis or MongoDB trustworthy?
Core PHP and bundled or external standard extensions are the well-maintained part of the corpus. The README is explicit that non-standard extension stubs are provided as is, are community-driven, and that only the PHPDoc is validated, not whether the stub matches the real extension or whether descriptions are correct. There are also no tests for thrown exceptions, so @throws tags must be checked manually against official docs. Treat PECL stubs as a completion aid, not a source of truth for type contracts.
Which PHP and Laravel versions does jetbrains/phpstorm-stubs support, and how should I pin it?
The package is PHP-version agnostic in the sense that it is just a set of stub files, and it has no Laravel coupling at all. Releases track PhpStorm builds, such as v2024.2 or v2022.x, rather than PHP or Laravel versions. Pin an explicit tag in composer.json so signature changes do not drift silently, and assign an owner for the bump cadence whenever the team upgrades PhpStorm.
Can I use jetbrains/phpstorm-stubs with VS Code, Intelephense, or Phpactor instead of PhpStorm?
Some tools can consume extra stub directories, but most VS Code PHP extensions rely on their own bundled definitions and expect a different stub format or configuration path. If a significant share of your team does not use PhpStorm, the value of this package drops sharply for them. Establish which IDE each developer actually runs before budgeting any time for the integration.
Is jetbrains/phpstorm-stubs safe for production, and what are the license obligations?
It is a developer tooling artifact and should never ship in a runtime image, which composer install --no-dev already handles. The code is Apache-2.0, with CC-BY 3.0 material originating from the PHP Documentation Group. Internal developer use is fine, but redistributing or vendoring the stubs into a base image or shared golden repository carries attribution obligations you should document. It has no bearing on Laravel's service container, routing, or persistence.
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.
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
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections