1. Go to this page and download the library: Download irap/table-creator 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/ */
irap / table-creator example snippets
use iRAP\TableCreator\DatabaseField;
use iRAP\TableCreator\TableCreator;
use iRAP\TableCreator\Testing\AbstractTest;
function createTestTable(\mysqli $db)
{
$tableCreator = new TableCreator($db, "test_table");
$fields = array(
DatabaseField::createInt('id', 11, true),
DatabaseField::createBool('bool_field'),
DatabaseField::createVarchar('varchar_field', 255),
DatabaseField::createChar('char_field', 3),
DatabaseField::createDate('date_field'),
DatabaseField::createDecimal('decimal_field', 5, 4),
DatabaseField::createGeometry('geometry_field'),
DatabaseField::createGeometryCollection('geometry_collection_field'),
DatabaseField::createLineString('line_string_field'),
DatabaseField::createLongText('long_text_field'),
DatabaseField::createMultiLineString('multi_line_string_field'),
DatabaseField::createMultiPoint('multi_point_field'),
DatabaseField::createMultiPolygon('multi_polygon_field'),
DatabaseField::createPoint('point_field'),
DatabaseField::createPolygon('polygon_field'),
DatabaseField::createText('text_field'),
DatabaseField::createTimestamp('timestamp_field')
);
$tableCreator->addFields($fields);
$tableCreator->setPrimaryKey('id');
$tableCreator->run();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.