Download the PHP package nathanburkett/mesa without Composer
On this page you can find all versions of the php package nathanburkett/mesa. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nathanburkett/mesa
More information about nathanburkett/mesa
Files in nathanburkett/mesa
Informations about the package mesa
Mesa
Mesa is a programmatic table builder and/or interpreter.
Installation
Usage
Via GeneratesTables
Trait
Using the GeneratesTables
trait is the simplest way to start consuming tables.
Then build a table by calling:
$tableContext
is the data source the table is interpreting.
An optional callable can be passed to generateTable
as the 2nd parameter which will be run on each of the table iteration's value and will replace that value.
Example:
In the above example, $table['two']['name']
would equal 'baz'
.
Loaders
The current default behavior of $tableContext
passed as the first parameter to GeneratesTables::generateTable()
is intended to be an absolute path to a PHP or YAML file. Anything else and FileLoaderFactory
will throw an exception.
Other types can be interpreted by extending GeneratesTables::getLoaderFactory()
Output
Once data has been read into a table, it will then be output by an OutputStrategy. The default OutputStrategy iterates over the table and yields an index and value via a generator function.
An optional callable can be passed as the 2nd parameter which will be run on each iteration's value and replace that iteration value.
An optional callable can be passed to generateTable
as the 2nd parameter which will be run on each of the table iteration's value and will replace that value.
Example:
In the above example, $table['two']['name']
would equal 'baz'
.
An alternate OutputStrategy can be used by overriding GeneratesTables::getOutputStrategy()