Create application script file and make it executable:
touch areafix
chmod a+x areafix
Content of areafix file:
#!/usr/bin/env php
<?php
// set to run indefinitely if needed
set_time_limit(0);
/* Optional. It’s better to do it in the php.ini file */
date_default_timezone_set('Europe/Kiev');.
// include the composer autoloader
require_once __DIR__ . '/vendor/autoload.php';.
// import the Symfony Console Application.
use Symfony\Component\Console\Application;.
use Commands\GreetCommand;
$app = new Application();
$app->add(new GreetCommand());
$app->run();
?>
I put my commands to src/Commands. Command example (from http://symfony.com/doc/current/components/console/introduction.html#creating-a-basic-command):
namespace Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class GreetCommand extends Command
{
protected function configure()
{
$this
->setName('demo:greet')
->setDescription('Greet someone')
->addArgument(
'name',
InputArgument::OPTIONAL,
'Who do you want to greet?'
)
->addOption(
'yell',
null,
InputOption::VALUE_NONE,
'If set, the task will yell in uppercase letters'
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$name = $input->getArgument('name');
if ($name) {
$text = 'Hello '.$name;
} else {
$text = 'Hello';
}
if ($input->getOption('yell')) {
$text = strtoupper($text);
}
$output->writeln($text);
}
}
Frequently Asked Questions on FTN Mailer Binkd
Version of December 05 2010
This list of Frequently Asked Questions was compiled from the questions
that were asked in the Russian echo conference RU.BINKD. Some part of the
answers is based on the developers' recommendations. Please send your
comments and updates to Stas Degteff 2:5080/102. This list was translated
from Russian by Michael Dukelsky 2:5020/1042.