PHP code example of wethersherbs / pineapple

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

    

wethersherbs / pineapple example snippets




use Pineapple\DB;
use Pineapple\DB\Driver\DoctrineDbal;

// lengthy dbal connection here...

$db = DB::factory(DoctrineDbal::class);
$db->setConnectionHandle($dbalConn);
$result = $db->query('SELECT USER(), DATABASE()');



use Pineapple\DB;
use Pineapple\DB\Driver\PdoDriver;

$db = DB::factory(PdoDriver::class);
$db->setConnectionHandle(new PDO('sqlite::memory:'));
$result = $db->query('SELECT CURRENT_TIMESTAMP');


use Pineapple\DB;

$query = $db->query('SELECT CURRENT_TIMESTAMP');
if (DB::isError($query) && $query->getCode() === DB::DB_ERROR_INVALID) {
    die();
}
shell
$ vendor/bin/phpunit --coverage-html='coverage/' --coverage-text='php://stdout' --colors=auto