A tool for interacting with PHP code from the command line. It is intended to be used alongside Respect\Config.
Usage: [action] [config] [command]
- print -p shows up a shell-friendly representation of the given command
- serve -s opens up a standalone PHP server serving the given command
- start -d opens up a PHP daemon for the given command
- interactive -a lets the user interact with the code
$ respect print Pdo --dsn='mysql:localhost;dbname=mydb' --user=root --password='' query 'SHOW TABLES'
Arguments starting with '--' are configuration/instantiation, other arguments are commands. Commands are always 'fluent', so the next command always runs upon the last command return.
This is equivalent to:
<?php
$command = new PDO('mysql:localhost;dbname=mydb', 'root', '');
$command = $command->query('SHOW TABLES');
return Respect\Cli\TextFormatter($command);
$ respect print --myconfig.ini db query 'SHOW TABLES'
INI file:
[db Pdo]
dsn = mysql:localhost;dbname=mydb
user = root
password = ""
Type the initial INI file:
$ respect interactive --myconfig.ini
Tab to auto-complete to container keys:
$ db
Tab again to auto-complete to methods/properties/constructor-parameters of that instance:
$ db query
Type your commands:
$ db query 'SHOW TABLES'
Great idea, let's code?