Download the PHP package jiaojie/pop-data without Composer
On this page you can find all versions of the php package jiaojie/pop-data. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jiaojie/pop-data
More information about jiaojie/pop-data
Files in jiaojie/pop-data
Package pop-data
Short Description Pop Data Component for Pop PHP Framework, This is a copy version.
License New BSD
Homepage http://www.popphp.org/
Informations about the package pop-data
pop-data
END OF LIFE
The pop-data
component v2.1.0 is now end-of-life. The CSV sub-component has
been forked and pushed into its own repository:
- popphp/pop-csv
OVERVIEW
pop-data
provides a streamlined way to convert common data types. With it, you can easily give it
some native PHP data and quickly produce a serialized version of that data in a common data type,
such as CSV, JSON, SQL, XML or YAML. Or, conversely, you can give it some serialized data, an it
will auto-detect the format and convert it to native PHP data.
pop-data
is a component of the Pop PHP Framework.
INSTALL
Install pop-data
using Composer.
composer require popphp/pop-data
BASIC USAGE
Serialize Data
The $csvString variable now contains:
first_name,last_name
Bob,Smith
Jane,Smith
The $jsonString variable now contains:
[
{
"first_name": "Bob",
"last_name": "Smith"
},
{
"first_name": "Jane",
"last_name": "Smith"
}
]
The $sqlString variable now contains:
INSERT INTO data (first_name, last_name) VALUES
('Bob', 'Smith'),
('Jane', 'Smith');
The $xmlString variable now contains:
<?xml version="1.0" encoding="utf-8"?>
<data>
<row>
<first_name>Bob</first_name>
<last_name>Smith</last_name>
</row>
<row>
<first_name>Jane</first_name>
<last_name>Smith</last_name>
</row>
</data>
The $yamlString variable now contains:
---
- first_name: Bob
last_name: Smith
- first_name: Jane
last_name: Smith
...
Unserialize Data
You can either pass the data object a direct string of serialized data or a file containing a string of serialized data. It will detect which one it is and parse it accordingly.
String
File
Convert Between Data Types
Write to File
Output to HTTP
Force download of file
Notice
This copy is used as a legacy library.