Skip to content

judus/argon-phinx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

argon-phinx

PHP Build codecov Psalm Level Latest Version Total Downloads License: MIT

Phinx migration integration for the Argon runtime stack.

Installation

composer require maduser/argon-phinx

Service Providers

Register PhinxServiceProvider, then configure migrations from an application service provider.

use Maduser\Argon\Container\AbstractServiceProvider;
use Maduser\Argon\Container\ArgonContainer;
use Maduser\Argon\Phinx\Config\PhinxConfigRegistry;
use Maduser\Argon\Phinx\Provider\PhinxServiceProvider;

final class AppServiceProvider extends AbstractServiceProvider
{
    #[\Override]
    public function register(ArgonContainer $container): void
    {
        $container->register(PhinxServiceProvider::class);
        $container->register(MigrationServiceProvider::class);
    }
}

final class MigrationServiceProvider extends AbstractServiceProvider
{
    #[\Override]
    public function register(ArgonContainer $container): void
    {
        $basePath = $container->getParameters()->get('basePath');
        assert(is_string($basePath));

        $container->get(PhinxConfigRegistry::class)
            ->addMigrationPath($basePath . '/database/migrations')
            ->addEnvironment('default', [
                'adapter' => 'sqlite',
                'name' => $basePath . '/storage/database/argon.sqlite',
                'suffix' => '',
            ])
            ->setDefaultEnvironment('default');
    }
}

For SQLite, Phinx appends .sqlite3 by default. Use 'suffix' => '' when the configured name is already the full database file path.

Console Commands

The provider exposes Phinx through the Argon console command tag:

php bin/console phinx:status
php bin/console phinx:migrate
php bin/console phinx:rollback
php bin/console phinx:create CreateUsers

The command names are prefixed to avoid collisions with application commands.

Boundaries

  • This package wires Phinx into Argon. It does not add a migration DSL.
  • Applications own migration paths, seed paths, environments, and database credentials.
  • Configuration is explicit service-provider code, not automatic file discovery.
  • Multiple environments are supported through Phinx configuration arrays.

Quality Gates

composer check
composer test:coverage
composer psalm
composer phpcs

About

Phinx migration integration for the Argon runtime stack.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages