PHP code example of komeiji-satori / miner

1. Go to this page and download the library: Download komeiji-satori/miner 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/ */

    

komeiji-satori / miner example snippets


$Miner = new Miner();
$Miner->select('*')
      ->from('shows')
      ->innerJoin('episodes', 'show_id')
      ->where('shows.network_id', 12)
      ->orderBy('episodes.aired_on', Miner::ORDER_BY_DESC)
      ->limit(20);

$Miner->getStatement();

$Miner->getPlaceholderValues();

$Miner->getStatement(false);

$PDOStatement = $Miner->execute();

$Miner = new Miner($PDO);

$Miner->setPdoConnection($PDO);

$Miner->select('*')
      ->from('shows')
      ->innerJoin('episodes', 'show_id')
      ->where('shows.network_id', 12)
      ->orderBy('episodes.aired_on', Miner::ORDER_BY_DESC)
      ->limit(20);

$Miner->insert('shows')
      ->option('HIGH_PRIORITY')
      ->set('network_id', 13)
      ->set('name', 'Freaks & Geeks')
      ->set('air_day', 'Tuesday');

$Miner->replace('shows')
      ->set('network_id', 13)
      ->set('name', 'Freaks & Geeks')
      ->set('air_day', 'Monday');

$Miner->update('episodes')
      ->set('aired_on', '2012-06-25')
      ->where('show_id', 12)
      ->openWhere(Miner::LOGICAL_OR)
      ->where('name', 'Girlfriends and Boyfriends')
      ->where('air_day', 'Monday', Miner::NOT_EQUALS)
      ->closeWhere();

$Miner->delete()
      ->from('shows')
      ->whereIn('show_id', array(12, 15, 20))
      ->limit(3);