Download the PHP package jspit/tablearray without Composer
On this page you can find all versions of the php package jspit/tablearray. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jspit/tablearray
More information about jspit/tablearray
Files in jspit/tablearray
Package tablearray
Short Description PHP library for arrays with tableslike structure
License MIT
Informations about the package tablearray
TableArray
PHP library for arrays with tableslike structure (V2.6.1)
Features
- Create from Array, JSON-String, CSV-String, Iterator or XML
- Methods for column selection, row filtering and sorting
- One file, no external requirements
Installation & loading
Manually:
- Code -> Download ZIP TableArray-master.zip
- Extract zip to a new Folder
Of course, you can also copy the TableArray source code to your editor and save it.
Install via Composer:
run
Usage
Simple example 1
Simple example 2
Pivot Group example
CSV Import example
Example filterGroupAggregate
Data input methods
- new TableArray ($dataArray,[$keyPathToData])
- create ($dataArray,[$keyPathToData])
- createFromJson ($jsonStr,[$keyPathToData])
- createFromXml ($xml, [$strXPath])
- createFromOneDimArray ($dataArray,[$delimiter])
- createFromString ($inputString, [$regExValues,[$regExSplitLines]])
- createFromGroupedArray($input, $keyArray)
- createFromCsvFile([$file])
General Working methods
- select
- orderBy
- innerJoinOn
- leftJoinOn
- flatten
- merge
- pivot
- offset
- limit
- transpose
- collectChilds
Filter methods
- filter
- filterEqual
- filterLikeAll
- filterLikeIn
- filterUnique
- filterGroupAggregate
Methods to fetch the data
- fetchAll
- fetchAllObj
- fetchAllAsJson
- fetchAllAsCSV
- fetchKeyValue
- fetchColumn
- fetchColumnUnique
- fetchGroup
- fetchRow
- fetchRaw
- fetchLimit
- fetchLimitFromEnd
Other methods
- addFlatKeys
- addKeys
- fieldAsKey
- firstRowToKey
- addSqlFunction
- addSqlFunctionFromArray
- getSqlFunction
- fieldNameRaw
- setOption
- getOption
- setCsvDefaultOptions($options)
- check($data)
- unGroup($array, $keys)
- count
- toClass
- print($comment,$limit)
Internal functions may be used by select and orderBy
- ABS(fieldName)
- UPPER(fieldName)
- FIRSTUPPER(fieldName)
- LOWER(fieldName)
- TRIM(fieldName[,'character_mask'])
- FORMAT('format',fieldName[,fieldName])
- SCALE(fieldName,'factor'[,'add'[,'format']])
- DATEFORMAT('dateFormat',fieldName)
- REPLACE('search','replace',fieldName)
- SUBSTR(fieldName,'start'[,'length'])
- LIKE(fieldName,'likePattern')
- INTVAL(fieldName,'basis')
- FLOATVAL(fieldName,['dec_point', 'thousands_sep'])
- NULLCOUNT(fieldName[,fieldName,..])
- CONCAT(fieldName[,fieldName,..])
- IMPLODE(arrayFieldName,['delimiter'])
- SPLIT(fieldName[,'delimiter'[,'number']])
Interface
- Iterator
- JsonSerializable
Class Methods
select
Select rows for a fetch ->select('field1, field2,..') ->select('field1 as newName,..') ->select('fct(field1) as newName,..)
orderBy
Sorts the array by one or more columns in ascending or descending order.
->orderBy('field1 [ASC|DESC][NATURAL], [field2..]')
->orderBy('fct(field1,[params]),[field|function..])
Documentation
http://jspit.de/tools/classdoc.php?class=TableArray
Examples and Test
http://jspit.de/check/phpcheck.class.tablearray.php
Requirements
- PHP 7.x