PHPackages                             schlndh/maria-stan - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. schlndh/maria-stan

ActivePhpstan-extension[Utility &amp; Helpers](/categories/utility)

schlndh/maria-stan
==================

Static analyser for MariaDB queries

96.9k↑125%1PHPCI passing

Since Jun 5Pushed 4w ago1 watchersCompare

[ Source](https://github.com/schlndh/maria-stan)[ Packagist](https://packagist.org/packages/schlndh/maria-stan)[ RSS](/packages/schlndh-maria-stan/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

MariaStan
=========

[](#mariastan)

MariaStan is a static analysis tool for MariaDB queries. Its primary purpose is to serve as a basis for [PHPStan](https://phpstan.org/) extensions.

**Current status** (29. 05. 2026):

MariaStan is very much incomplete. It covers probably ~90% of use-cases in a large code-base where I use it (hundreds of tables, thousands of queries). As a result there is not much activity. But it is actively maintained in the sense that if something breaks for me, it will probably get fixed.

If you try to use it in your project, you are likely to run into use-cases which are not implemented (e.g. syntax/functions which my project doesn't use). If that happens, you should be prepared to fix things for yourself (most things should be easy).

There is no backwards-compatibility promise on anything, and there are no releases - I just use master.

MariaStan is tested with MariaDB 11.8.6 and PHP 8.1-8.5.

Installation
------------

[](#installation)

Install MariaStan using `composer require --dev schlndh/maria-stan:dev-master`. Then you'll need to add the following to your `phpstan.neon`:

```
includes:
    - ./vendor/schlndh/maria-stan/extension.neon
```

Configuration
-------------

[](#configuration)

MariaStan needs access to the database schema. The easiest way to provide it is to let it connect directly to a database. You'll need to add the following configuration to your `phpstan.neon` and set proper credentials:

```
parameters:
    maria-stan:
        # Change these to match your database
        reflection:
            defaultDatabase: 'database'
        db:
            host: 127.0.0.1
            port: 3306
            user: 'root'
            password: ''
```

MariaStan needs access to a database to fetch the schema for query analysis. It only reads table schema and does not write anything. Nevertheless, **DO NOT** give it access to any database which contains any important data.

Alternatively, it is also possible to use MariaStan without access to the database during analysis. In that case you'll need to first dump the schema using `MariaDbFileDbReflection::dumpSchema` and save it into a file. Here is an example script that does that:

```
