PHP code example of popphp / pop-data
1. Go to this page and download the library: Download popphp/pop-data 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/ */
popphp / pop-data example snippets
$phpData = [
[
'first_name' => 'Bob',
'last_name' => 'Smith'
],
[
'first_name' => 'Jane',
'last_name' => 'Smith'
]
];
$data = new Pop\Data\Data($phpData);
$csvString = $data->serialize('csv');
$jsonString = $data->serialize('json');
$sqlString = $data->serialize('sql');
$xmlString = $data->serialize('xml');
$yamlString = $data->serialize('yaml');
$csv = new Pop\Data\Data($csvString);
$phpData = $csv->unserialize();
$xml = new Pop\Data\Data('/path/to/file.xml');
$phpData = $xml->unserialize();
$csv = new Pop\Data\Data($csvString);
$xml = $csv->convert('xml');
$phpData = [ ... ];
$data = new Pop\Data\Data($phpData);
$data->serialize('csv');
$data->writeToFile('/path/to/file.csv');
$phpData = [ ... ];
$data = new Pop\Data\Data($phpData);
$data->serialize('csv');
$data->outputToHttp();
$phpData = [ ... ];
$data = new Pop\Data\Data($phpData);
$data->serialize('csv');
$data->outputToHttp('my-file.csv', true);