diablomedia / phinx-bundle
diablomedia phinx bundle
Package info
github.com/diablomedia/phinx-bundle
Type:symfony-bundle
pkg:composer/diablomedia/phinx-bundle
Requires
- php: ~8.2 || ~8.3 || ~8.4 || ~8.5
- robmorgan/phinx: ^0.16
- symfony/framework-bundle: ^7.0 || ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.88
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.5
- rector/rector: ^2.2
This package is auto-updated.
Last update: 2026-07-28 23:45:21 UTC
README
Composer
The fastest way to install Phinx bundle is to add it to your project using Composer (http://getcomposer.org/).
-
Install Composer:
curl -sS https://getcomposer.org/installer | php -
Require Phinx bundle as a dependency using Composer:
php composer.phar require diablomedia/phinx-bundle -
Install bundle:
php composer.phar install -
Add bundle to
config/bundles.phpreturn [ // [...] DiabloMedia\PhinxBundle\DiabloMediaPhinxBundle::class => ['all' => true], ];
-
Add bundle config to
config/packages/diablo_media_phinx.yamlMinimal example:
diablo_media_phinx: environment: connection: dsn: 'mysql://db_user:db_password@127.0.0.1:3306/db_name'
Configuration
The bundle can be installed and Symfony's cache can be built without any configuration. A database connection is required before running commands that access the database.
| Option | Type / default | Description |
|---|---|---|
migration_base_class |
class-string; Phinx's AbstractMigration |
Base class used by newly generated migrations. The class must extend Phinx's AbstractMigration. |
adapters |
map; empty | Registers custom Phinx database adapters. Each key is the adapter name used by a DSN and each value is a class implementing Phinx's AdapterInterface. |
paths.migrations |
string, list, or namespace map; %kernel.project_dir%/src/Resources/db/migrations |
Location or locations scanned for migrations. A keyed map associates migration namespaces with paths. Glob patterns are supported by Phinx. |
paths.seeds |
string, list, or namespace map; %kernel.project_dir%/src/Resources/db/seeds |
Location or locations scanned for seed classes. A keyed map associates seed namespaces with paths. |
environment.connection.dsn |
string; required when connection is configured |
Database-agnostic connection URL in the form <adapter>://[<user>[:<password>]@]<host>[:<port>]/<database>[?<options>]. Common adapters are mysql, pgsql, sqlite, and sqlsrv. |
environment.migration_table |
string; phinxlog |
Table used by Phinx to record which migrations have run. Schema-qualified names such as phinx.log are supported by databases such as PostgreSQL. |
environment.table_prefix |
string; none | Prefix Phinx applies to table names handled through its adapter. |
environment.table_suffix |
string; none | Suffix Phinx applies to table names handled through its adapter. |
environment.prompt_password |
boolean; false |
Prompts for the database password using a hidden Symfony Console question before database-dependent commands run. Create commands do not prompt. |
For example:
diablo_media_phinx: migration_base_class: App\Migration\AbstractMigration paths: migrations: App\Migrations: '%kernel.project_dir%/migrations' seeds: App\Seeds: '%kernel.project_dir%/seeds' adapters: custom: App\Database\CustomPhinxAdapter environment: migration_table: phinx_migrations table_prefix: app_ connection: dsn: 'mysql://db_user:db_password@127.0.0.1:3306/db_name?charset=utf8mb4'
The bundle exposes a single Phinx environment named default; Symfony
configuration determines its connection and paths. See the
Phinx configuration reference
for more detail about DSNs, migration paths, adapters, and migration behavior.
Interactive database password
To keep the database password out of configuration and environment variables, omit it from the DSN and enable the password prompt:
diablo_media_phinx: environment: prompt_password: true connection: dsn: 'mysql://db_user@127.0.0.1:3306/db_name'
Database-dependent commands will ask for the password without displaying it:
Password for db_user@127.0.0.1:
Commands run with --no-interaction cannot prompt and will stop with an
explanatory error. For CI and automated deployments, use a separate Symfony
configuration that supplies a complete DSN and leaves prompt_password
disabled.