Skip to content

Build a table from an array of arrays, objects or collections

Notifications You must be signed in to change notification settings

Crinsane/TableBuilder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TableBuilder

A simple table builder implementation. Build tables from from data. Accepted data is an array of:

  • Arrays
  • Objects
  • Collections (Laravel Specific)

Installation

Install the package through Composer. Edit your project's composer.json file by adding:

"require": {
	"gloudemans/tablebuilder": "dev-master"
}

Next, run the Composer update command from the Terminal:

composer update

Laravel

If you want to use this package in your Laravel application all you have to do is add the service provider of the package and alias the package. To do this open your app/config/app.php file.

Add a new line to the service providers array:

'Gloudemans\TableBuilder\TableBuilderServiceProvider'

And finally add a new line to the aliases array:

'Table'            => 'Gloudemans\TableBuilder\Facades\Table',

Now you're ready to start using the table builder in your application.

Usage

Currently the package has only one public method, generate(). This method takes one mandatory and two optional arguments.

$builder->generate($data); 						  // Generates a table with the specified data, headers will be the values keys of the data
$builder->generate($data, $attributes); 		  // Adds attributes to the `<table>` tag. (class, id, etc.)
$builder->generate($data, $attributes, $headers); // Gives you the ability to specify the headers yourself.

About

Build a table from an array of arrays, objects or collections

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages