| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Command Line Application with common features built using phalcon framework. More info could be found here
PHP 5.4 or greater
Required PHP Modules
To check if phalcon module is installed/enabled for CLI use
$ php -m | grep -i "phalcon"
phalcon(number of directions) (number of experts) (couldSolve matrix) (costs array)
Example:
20 6 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1 0 1 1 0 0 1 1 0 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 10 20 30 5 40 11
Open php-cli-app-phalcon/app/config.php and edit your database connection credentials
$settings = array(
'database' => array(
'adapter' => 'Mysql', /* Possible Values: Mysql, Postgres, Sqlite */
'host' => 'your_ip_or_hostname',
'username' => 'your_user',
'password' => 'your_password',
'name' => 'your_database_schema',
'port' => 3306
),
);Import the tables into your MySQL Server
mysql -u root -p your_database_schema < php-cli-app-phalcon/schema/mysql.data.sqlImport the tables into your Postgres Server
psql -U root -W -f postgres.data.sql your_database_schemaGeneral Syntax for running a task/job (Note: only Task is required)
cd php-cli-app-phalcon/private
php cli.php [Task] [Action] [Param1] [Param2] [...]Tasks are stored in php-cli-app-phalcon/app/tasks directory. The following example task is named ExampleTask.php. Basic example of how to kick off a cli job/task.
cd php-cli-app-phalcon/private
php cli.php Example test1 Passing parameters to your application
php cli.php Example test2 bob sanders Enable debug mode to see a more detailed overview of what is going on --debug This also enables a more verbose level of php reporting, displaying all php warnings.
php cli.php Example cmd --debugRecord all output to the database (in the task table) --record .
php cli.php Example test1 --recordOnly allow 1 instance to run at a time --single
php cli.php Example test1 --singleEnable all flags
php cli.php Example test1 --debug --record --singleGo to php-cli-app-phalcon/app/tasks directory. This is where all the tasks are stored. Just go ahead and create a new file here (eg. NewTask.php)
<?php
namespace Tasks;
use \Cli\Output as Output;
class NewTask extends \Phalcon\Cli\Task {
public function workAction() {
Output::stdout("hi");
}
}
?>Now run it!
cd php-cli-app-phalcon/private
php cli.php New workNote: All classes must be namespaced if you use the provided autoloader.
Open php-cli-app-phalcon/app/config/autoload.php and an element to the existing array. So, you have to use namespacing to load new classes.
$autoload = [
'Utilities\Debug' => $dir . '/library/utilities/debug/',
'Trend' => $dir . '/library/trend/'
];
return $autoload;| Back | FazBrowse Home | New Git URL |