Download the PHP package staabm/phpstan-dba without Composer
On this page you can find all versions of the php package staabm/phpstan-dba. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package phpstan-dba
phpstan-dba
: PHPStan based SQL static analysis and type inference for the database access layer
phpstan-dba
makes your phpstan static code analysis jobs aware of datatypes within your database.
With this information at hand we are able to detect type inconsistencies between your domain model and database-schema.
Additionally errors in code handling the results of sql queries can be detected.
This extension provides the following features, as long as you stick to the rules:
- result set type-inference
- detect errors in sql queries
- detect placeholder/bound value mismatches
- query plan analysis to detect performance issues
- builtin support for
doctrine/dbal
,mysqli
, andPDO
- API to configure the same features for your custom sql based database access layer
- Opt-In analysis of write queries (since version 0.2.55+)
In case you are using Doctrine ORM, you might use phpstan-dba
in tandem with phpstan-doctrine.
[!NOTE] At the moment only MySQL/MariaDB and PGSQL databases are supported. Technically it's not a big problem to support other databases though.
Talks
phpstan-dba - check your sql queries like a boss May 2023, at PHP Usergroup in Frankfurt Main (Germany).
DEMO
see the 'Files Changed' tab of the DEMO-PR for a quick glance.
💌 Support phpstan-dba
Consider supporting the project, so we can make this tool even better even faster for everyone.
Installation
First, use composer to install:
Second, create a phpstan-dba-bootstrap.php
file, which allows to you to configure phpstan-dba
(this optionally includes database connection details, to introspect the database; if you would rather not do this see Record and Replay:
[!NOTE] Configuration for PGSQL is pretty similar
Third, create or update your phpstan.neon
file so bootstrapFiles includes phpstan-dba-bootstrap.php
.
If you are not using phpstan/extension-installer, you will also need to include dba.neon
.
Your phpstan.neon
might look something like:
Finally, run phpstan
, e.g.
Read more
All versions of phpstan-dba with dependencies
composer-runtime-api Version ^2.0
composer/semver Version ^3.2
doctrine/dbal Version 3.*
phpstan/phpstan Version ^2.0