PHP code example of lambdacasserole / condense

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

    

lambdacasserole / condense example snippets


$db = new Database('employees');

$db = new Database('employees', '../storage');

$db = new Database('secrets', '../private', 'my-secret-password');

$hire = ['first_name' => 'Ethan', 'last_name' => 'Benson', 'salary' => 20000];
$employees->insert($hire);

// Returns the salary of the first employee with the first name 'Ethan' (20000).
$employees->get('salary', 'first_name', 'Ethan');

// Returns the whole database.
$employees->select([]);

// Returns the first name of each employee, for example: 
// [['Ethan'],['Thomas'],['James']]
$employees->select(['first_name']);

// Change every employee with a first name 'Ethan' to have the surname 'Smithers'.
$employees->to('last_name', 'Smithers', 'first_name', 'Ethan');

// Change the first row in the database completely.
$employees->update(0, ['first_name' => 'Alison', 'last_name' => 'Bradberry']);

// Remove the first row in the database.
$employees->remove(0);

php composer.phar