PHP code example of mafuth / php-cli

1. Go to this page and download the library: Download mafuth/php-cli 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/ */

    

mafuth / php-cli example snippets


echo $COMPILER->output($PAGE,false);

$DB->selectFrom($table);
$data = $DB->execute(); // this will return an array of all data selected;

$DB->selectFrom($table);
$DB->where(array(
  'id'=>1,
  'name'=>array(
      'john',
      'doe'
  )
));
$data = $DB->execute(); // this will return an array of all data selected;

$DB->deleteFrom($table);
$DB->where(array(
  'id'=>1,
  'name'=>array(
      'john',
      'doe'
  )
));
$data = $DB->execute(); // this will return true if successful and false if failed
$error = $data['message]; // this has the error message

$DB->updateFrom($table);
$DB->set(array(
  'name'=>'john'
));
$DB->where(array(
  'id'=>1
));
$data = $DB->execute(); // this will return true if successful and false if failed
$error = $data['message]; // this has the error message

$DB->insert(array(
  'john'
));
$DB->to($table);
$data = $DB->execute(); // this will return true if successful and false if failed
$error = $data['message]; // this has the error message

$DB->insertTo($table,array(
  'name'=>'john'
));
$data = $DB->execute(); // this will return true if successful and false if failed
$error = $data['message]; // this has the error message
sh
   php cli --v
   
sh
   php cli --config
   
sh
   php cli --serve
   
sh
git config --global user.email "Email as on github"
sh
php cli --git
sh
   php cli recreate-tables
   
sh
php cli pwa-code
sh
php cli --git make ftp deploy
sh
php cli --git make sftp deploy
sh
php cli make docker container
sh
php cli db backup
sh
php cli db restore