Connecting to Mysql

The database connection is established in a global variable called $DBA in the index.php file for convenience, you could put it anywhere as long as it is global and required before any database functionality is required.

For MySQL database type:

<?php
require_once "./vendor/autoload.php";

//  Initialize MySQL Database
global $DBA;
$DBA = new \Tina4\DataMySQL(
    "localhost:somedatabase", 
    DB_USERNAME, DB_PASSWORD, 
    "d/m/Y");
    
$config = new \Tina4\Config();
\Tina4\Initialize();
echo new \Tina4\Tina4Php($config);

Tina4 is a dynamic system and should already have the tools you need, but due to Tina4 being Bleeding Edge tech, there might be a chance you have trouble with the database, thus run the following commands to install the Database and MySQL files required for your system:

composer require tina4stack/tina4php-mysql
composer require tina4stack/tina4php-database

For a custom database hostname and port use the following format in your ENV file:

DB_NAME=10.248.228.22/3306:databasename

Note the Date Format which should be in your localized format. Tina4 will transpile your dates for you depending on your Database Engine's preferred date format.

Powered by ComboStrap