ebrana / mate-tools
Generic Symfony AI Mate tools for eBRANA projects (dev only)
Requires
- php: >=8.5
- ext-mbstring: *
- ext-pdo_pgsql: *
- doctrine/dbal: ^4.0
- doctrine/doctrine-bundle: ^2.13 || ^3.0
- symfony/ai-mate: ~1.0.0@beta
- symfony/ai-monolog-mate-extension: ~1.0.0@beta
- symfony/ai-symfony-mate-extension: ~1.0.0@beta
- symfony/clock: ^7.4 || ^8.0
- symfony/error-handler: ^7.4 || ^8.0
- symfony/http-client: ^7.4 || ^8.0
- symfony/http-client-contracts: ^3.0
- symfony/http-kernel: ^7.4 || ^8.0
- symfony/process: ^7.4 || ^8.0
Requires (Dev)
- ebrana/php-cs-fixer-config: ~1.0.0
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.5 || ^12.0 || ^13.0
- symfony/doctrine-bridge: ^7.4 || ^8.0
- symfony/http-foundation: ^7.4 || ^8.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-12-03 11:54:34 UTC
README
Generic Symfony AI Mate extension for Symfony + Doctrine +
PostgreSQL projects (dev only). Gives agents compact, read-only tools instead of psql, curl, log greps and the
web profiler.
PostgreSQL only: the ebr-sql tool relies on pg_read_all_data and PostgreSQL catalogs.
Install
composer require --dev ebrana/mate-tools
Mate is BETA and Composer ignores inline @beta flags of dependencies, so the consumer's root composer.json must
allow it: either "minimum-stability": "beta" with "prefer-stable": true, or require symfony/ai-mate,
symfony/ai-symfony-mate-extension and symfony/ai-monolog-mate-extension as ~1.0.0@beta in its own require-dev.
The package is registered in mate/extensions.php by mate discover. It runs automatically on composer install/update when symfony/ai-mate-composer-plugin is allowed, otherwise run vendor/bin/mate discover. Do not
write extensions.php by hand; only the enabled / mode values are yours to change.
The monolog and symfony Mate extensions must stay enabled: ebr-log-errors needs LogReader and ebr-api-request needs
ProfilerDataProvider, so disabling either breaks container compilation. ProfilerDataProvider is @internal to the
Symfony extension, hence the ~1.0.0 pin.
Check the registration:
vendor/bin/mate debug:extensions vendor/bin/mate tools:list --extension=ebrana/mate-tools
DATABASE_URL is read from the process environment. To load the project's .env, set
->set('mate.env_file', '.env') in mate/config.php.
Tools
| Tool | Purpose |
|---|---|
ebr-sql |
one SELECT/WITH/EXPLAIN in a READ ONLY transaction as pg_read_all_data, 5 s timeout |
ebr-table |
kind, columns, PK, indexes, FKs and estimated rows of one table or view |
ebr-db-status |
pending migrations, mapping validity, schema diff (calls the app console) |
ebr-log-errors |
errors from var/log grouped by normalised message |
ebr-api-request |
GET request to the running app, with SQL summary and exception from its profiler |
It also adds a compact db formatter for the profiler resource.
Parameters
Override in the project's mate/config.php.
| Parameter | Default | Meaning |
|---|---|---|
mate_tools.database |
['url' => '%env(default::DATABASE_URL)%'] |
DBAL connection params (url DSN, host, port, user, password, dbname, charset, sslmode, application_name); driver is always pdo_pgsql |
mate_tools.console |
bin/console |
console script, relative to %mate.root_dir% or absolute |
mate_tools.console_memory_limit |
1G |
memory_limit of the console child processes |
mate_tools.api_base_uri |
'' |
base URI for ebr-api-request; the tool fails with a hint while empty |
mate_tools.api_user |
null |
username for lexik:jwt:generate-token; null means no default auth |
mate_tools.api_user_class |
null |
passed as --user-class=; null omits the option |
ebr-api-request option auth=user|none defaults to user when mate_tools.api_user is set, otherwise none.
auth=user is only allowed for local base URIs (localhost, 127.0.0.1, *.loc).
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $container): void { $container->parameters() ->set('mate_tools.database', [ 'host' => '%env(DATABASE_HOST)%', 'port' => '%env(int:DATABASE_PORT)%', 'user' => '%env(DATABASE_USER)%', 'password' => '%env(DATABASE_PASSWORD)%', 'dbname' => '%env(DATABASE_DB)%', ]) ->set('mate_tools.api_base_uri', 'https://app.loc') ->set('mate_tools.api_user', 'admin') ->set('mate_tools.api_user_class', 'App\Entity\User'); };
Project-specific tools
Tools for one project belong in that project's mate/src/, not here. Prefix their names with the project name
(e.g. shop-*): Mate keys discovered tools by name, so a duplicate name silently overwrites
the other tool without any error.
Development
composer install
composer phpstan
composer cs
composer test
Database tests need MATE_TOOLS_TEST_DATABASE_URL (e.g. postgresql://postgres:postgres@localhost:5432/postgres,
a role allowed to SET ROLE pg_read_all_data) and are skipped without it.