sachoo / phalcon-console
Based on phalcon devtools, this tools provide a console component with powerfull migration system for Mysql and Cassandra
Installs: 129 678
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 2
Open Issues: 1
Requires
- php: >=5.5
- ext-phalcon: ^3.0
- sachoo/phalcon-console-migration: 2.*
- sachoo/phalcon-model-annotations: 1.*
This package is not auto-updated.
Last update: 2025-03-23 06:37:55 UTC
README
This components is based on Phalcon Devtools and provides a really cool console to migrate your databases based on your models metadatas. Also, you could add your own commands.
Requirements
- PHP >= 5.5
- Phalcon >= 3.0.0
Installing via Composer
Install composer in a common location or in your project:
curl -s http://getcomposer.org/installer | php
Create the composer.json file as follows:
{ "require": { "sachoo/phalcon-console": "~1.*" } }
Run the composer installer:
php composer.phar install
If it not exists yet, create a console binary script at the root of your project. If you need an example, you can copy console.example.php from sachoo/phalcon-console component:
cp vendor/sachoo/phalcon-console/console.example.php console.php
To enable the commands you want, those you've wrote, and those from community, you have to add a new array on your config:
'commandsToEnable' => [ \Phalcon\Commands\Builtin\Info::class, \Phalcon\Commands\Builtin\Enumerate::class, \Phalcon\Commands\Builtin\Migration::class, \Phalcon\Commands\Builtin\ClearCache::class, \Commands\MyCommand::class ],
Also, you have to include your boostrap on line 12 properly
require __DIR__ . '/app/bootstrap_cli.php';
Usage
To get a list of available commands just execute following:
./console.php
This command should display something similar to:
Available commands: info (alias of: i) commands (alias of: list, enumerate) mig (alias of: migration) cc (alias of: clear-cache)
Migration
Migrations commands generate scripts with datetime versioning. In your configuration file, you must to define a config->application->migrationDir value. Then you have to manage your model metadatas with sachoo/phalcon-model-annotations
To know more about the power of Migrations, execute:
./console mig
This command should display something similar to:
Help: Migration Commands Usage: Generate a Migration mig gen Usage: Run all available Migrations mig run Usage: Run just one migration up mig up Usage: Run just one migration down mig down Usage: Generate migration file with Diff beetween Models and your Databases mig diff Usage: Show migration status mig status