1. Go to this page and download the library: Download isublimity/shell library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
isublimity / shell example snippets
class xyzActions
{
/**
* Получить список бла-бла
*
* @param string $name Назврание
* @param bool $reg включить или выключить
* @return array
*/
public function listCommand($name,$reg=false)
{
echo "My name $name ";
if ($reg) echo " ;) ";
echo "\n";
}
}
\Shell::name("xyz");
\Shell::run(
new xyzActions()
);
class xyzActions
{
public function getTitle()
{
return 'ABOUTE xyzActions - <red>XYZ</red>';
}
}
class xyzActions
{
public function setColor($value)
{
echo "CALL setColor($value)\n";
}
}
Автоматически вызовется если : > php test.php --color=YXA
// Блокирует исполнение
Shell::maxExecutionMinutes(0.5);//30 seconds
Shell::dir(__DIR__); // сменить директорию
Shell::alertMail('[email protected]'); // куда отпраить ошибки
Shell::setPathLog("/tmp/"); // куда записывать все сообщения
Shell::setPathPid("/tmp/"); // где PID
Shell::setExitCodeOnPidExists(2); // Exit code on PID file Exists
Shell::setPidCommands(array('check','test')); // какие комманды можно запускать одновренменно
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.