PHP code example of retamayo / tablemancer

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

    

retamayo / tablemancer example snippets




etamayo\Tablemancer\Facade;
use Retamayo\Tablemancer\Table;

// Create a database connection (replace with your own connection)
$pdo = new  \PDO("mysql:host=localhost;dbname=mydatabase", "username", "password");

// Initialize Tablemancer
$tablemancer = new  Facade($pdo);

// Create a new Table Object
$tableInstance = new  Table(
    name: 'tableName',
    columns: [
        'name',
        'age'
    ],
    primary: 'id',
    sensitive: []
);

// Add the new Table object to the Schema class.
$tablemancer->addTable('tableName', $tableInstance);

// Create a new record on the database.
$tablemancer->create('tableName', ["name" => "tablemancer", "age" => "100"]);