PHP code example of xentixar / mantrajna

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

    

xentixar / mantrajna example snippets




use Xentixar\Mantrajna\Unicorn;

// Create an instance of Mantrajna Unicorn
$mantrajna = new Unicorn();

// Read data from a CSV file
$mantrajna->readCsv('example.csv');

// Filter data where the 'age' column is greater than 25
$mantrajna->where(['age', '>', 25]);

// Sort the data based on the 'name' column in descending order
$mantrajna->sort('name', 'DESC');

// Execute all the instruction
// Before using print or get you have to call run function to save all the changes.
$mantrajna->run();

// Print the resulting data
$mantrajna->print();

$mantrajna->readCsv('example.csv', ',');

$mantrajna->readJson('example.json');

$mantrajna->readXml('example.xml');

$mantrajna->where(['age', '>', 25]);

$mantrajna->sort('name', 'DESC');

$mantrajna->setColumnInfo('birthdate:datetime:Y-m-d', 'score:double');

$mantrajna->format('birthdate:Y-m-d');

$mantrajna->update(['age', 'score'], [30, 95.5]);

$mantrajna->selectColumns('name', 'age');

$mantrajna->print();

$mantrajna->dumpJson('output.json');

$mantrajna->dumpXml('output.xml');

$mantrajna->dumpCsv('output.csv', ',');