PHP code example of starlit / db

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

    

starlit / db example snippets



// Adding a user using SQL
$db = new Db('localhost', 'db_user', '****', 'database_name');
$db->insert('users_table', ['name' => 'John Doe']);

// Adding a user using object mapping
$service = new BasicDbEntityService($db);
$user = new User();
$user->setName('John Doe');
$service->save($user);