1. Go to this page and download the library: Download m35/thecsv 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/ */
m35 / thecsv example snippets
use m35\thecsv\theCsv;
theCsv::export('tableName'); // return true if success
theCsv::export('user');
use m35\thecsv\theCsv;
theCsv::export('tableName'); // return true if success
theCsv::export([
'query' => (new \yii\db\Query)->from('user'),
]);
$fp = fopen('./data.csv', 'w');
theCsv::export([
'data' => [
['a', 'b', 'c'],
['A', 'B', 'C'],
],
'fp' => $fp, // fp resource you want to put the data in
]);