A complete platform for building web applications.

Creator

Creator is a command line interface which provides commands to generate files or execute actions.

ErtikazOS: 1.4.0

Usage:
 creator token                    Create account on ErtikazOS store.
         $action                  Perform one of the following create, reset and set.
         $email                   Your email.
         $name or $code           Your name on create action or activation code on set action.
 creator migrate                  Migrate the database to last migration version.
         $version or $name        Migrating file by its $version or $name.
         $direction               Migrating direction up or down.
 creator seed                     Seed database with last seeder file.
         $version or $name        Seeding file by its $version or $name.
         $direction               Seeding direction up or down.
 creator push                     Upload the application package to ErtikazOS store.
         $app_name                The application name.
 creator make                     Make new migration or seeder or model or controller or view.
         $type                    Can be one of the following values: command, migration, seeder, model, controller and view.
         $name                    The name of the file.
         $app                     The application name.
 creator pack                     Creating application package for ErtikazOS store.
         $app_name                The application name.
 creator pull                     Download application package from ErtikazOS store.
         $app_name                The application name.
         $app_version             The application version.

Write a command

create a command file in application/controllers/Creator/commands directory. let's say the name of our command is activateuser then the file name will be Activateuser_Command.php.

File structure

The command line code will like this:

<?php
class Activateuser_Command extends Command {

    /**
     * commands function.
     *
     * return command list as array.
     *
     * @access public
     * @return array
     */
    public function commands()
    {
        return [
            'name' => 'activateuser', 
            'desc' => 'activate user by username.',
            'vars' => [
                [
                    'name' => '$username', 
                    'desc' => 'Username of user.',
                ]
            ],
        ];
    }
    /**
     *
     * activateuser command.
     *
     */
    public function activateuser($username='')
    {
        if(trim($username)=='')
        {
            $this->_print('$username cannot be empty.', 'error', "\n\n");
            return FALSE;
        }

        /*
            Activate user code ...
        */

        $this->_print('User has been activated.', 'success');
    }
}
?>

After creating the above file it will appear automatically in creator command and you can use it like this

php creator activateuser myusername