2017 © Pedro Peláez
 

library phalcon-console

Based on phalcon devtools, this tools provide a console component with powerfull migration system for Mysql and Cassandra

image

sachoo/phalcon-console

Based on phalcon devtools, this tools provide a console component with powerfull migration system for Mysql and Cassandra

  • Thursday, February 23, 2017
  • by sachoo
  • Repository
  • 1 Watchers
  • 0 Stars
  • 550 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 66 % Grown

The README.md

Phalcon Console

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., (*1)

Requirements

  • PHP >= 5.5
  • Phalcon >= 3.0.0

Installing via Composer

Install composer in a common location or in your project:, (*2)

curl -s http://getcomposer.org/installer | php

Create the composer.json file as follows:, (*3)

{
    "require": {
        "sachoo/phalcon-console": "~1.*"
    }
}

Run the composer installer:, (*4)

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:, (*5)

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:, (*6)

'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, (*7)

require __DIR__ . '/app/bootstrap_cli.php';

Usage

To get a list of available commands just execute following:, (*8)

 ./console.php

This command should display something similar to:, (*9)

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, (*10)

To know more about the power of Migrations, execute:, (*11)

 ./console mig

This command should display something similar to:, (*12)

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

The Versions

23/02 2017

dev-master

9999999-dev

Based on phalcon devtools, this tools provide a console component with powerfull migration system for Mysql and Cassandra

  Sources   Download

MIT

The Requires

 

by Sacha Morard

framework command console migration cli phalcon

23/02 2017

1.0.1

1.0.1.0

Based on phalcon devtools, this tools provide a console component with powerfull migration system for Mysql and Cassandra

  Sources   Download

MIT

The Requires

 

by Sacha Morard

framework command console migration cli phalcon

23/02 2017

1.0.0

1.0.0.0

Based on phalcon devtools, this tools provide a console component with powerfull migration system for Mysql and Cassandra

  Sources   Download

MIT

The Requires

 

by Sacha Morard

framework command console migration cli phalcon