dans phpstorm, right click on, new command
EXAMPLE :
class GmailApiCommand extends ContainerAwareCommand {
... 
    protected function configure()
    {
        $this
            ->setName('qasoul_sand_box:gmail_api_command')
            ->setDescription('test api gmail');
    }
...
}
the string in "setName" will be used to call the command :
php ./bin/console qasoul_sand_box:gmail_api_command
in addition, call a command from a controller :
http://symfony.com/doc/current/console/command_in_controller.html