Download the PHP package aklump/loft_data_grids without Composer
On this page you can find all versions of the php package aklump/loft_data_grids. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aklump/loft_data_grids
More information about aklump/loft_data_grids
Files in aklump/loft_data_grids
Package loft_data_grids
Short Description PHP Classes to allow data placement in a grid structure and exporting in various data formats.
License BSD-3-Clause
Homepage http://www.intheloftstudios.com/packages/php/loft_data_grids
Informations about the package loft_data_grids
Loft Data Grids
There will be no new features added to this project. I suggest using the Symfony Serializer Component instead for similar functionality. The project will not receive ongoing support.
Summary
This package is a PHP object-oriented solution for modelling data in two (rows + columns) or three dimensions (rows + columns + pages). It can be thought of like a spreadsheet.
It allows a single data class ExportData
to be used to organize your data in a grid, with various output styles Exporter
so you can easily get a .csv
file or a .xlsx
file, among many others.
See the code for more documentation.
Install with Composer
- Require this package:
Usage
Let's build a two-layer data grid. (Layers are called pages.) The first page will contain names and ages of three people. The second page will contain vehicle information. It can be pictured in two tables:
Page 0 | Name | Age |
---|---|---|
Adam | 39 | |
Brandon | 37 | |
Charlie | 7 |
Page 1 | Color | Make |
---|---|---|
Black | Honda | |
White | BMW |
In Code
Accessing data from the object
Think of pointer as a row in a table.
Exporting data to other formats
We can export both pages in CSV like this:
Or to get it as JSON...
(This has been formatted for easier-reading; the actual JSON is minified.)
Or any of the other exporter classes.
Saving to File
Exporters: objects as values
- Exporters can handle objects if they implement the
objectHandler
method. - Exporters can handle \DateTime objects if they set a value for 'dateFormat'.
Testing
- Run the PhpUnit tests with
./bin/run_unit_tests.sh
All versions of loft_data_grids with dependencies
symfony/yaml Version ^3.4 || ^4 || ^5
phpoffice/phpspreadsheet Version ^1.10 || ^2.2