Download the PHP package meax/chtmltable without Composer

On this page you can find all versions of the php package meax/chtmltable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package chtmltable

Scrutinizer Code Quality Code Coverage Build Status

chtmltable

A HTML helper written in PHP to create a html table. Written for Anax-MVC.
First version includes the class SimpleHTMLTable.php and an example file in webroot folder, simplehtmltable.php.

To install with Composer and Packagist add chtmltable to your composer.json file in Anax.

"require": {
    "php": ">=5.4",
    "meax/chtmltable": "dev-master"
},

Move the example file simplehtmltable into your Anax installation's webroot folder.

How to build a table

Method createTable($columns, $data)
Accepts a multiarray $columns representing the header row and the columns of the table.
Accepts a multiarray or object $data which represents the rows of the table.

Example $columns

$columns = array([  
'name' => 'name',   
'label' => 'Name',     
],  
[  
'name' => 'id',     
 'label' => 'Id',    
]);

'name' - a value referring to a key in object or array $data
'label' - the label to be placed in between the tags.

Example $data

$data = array(  
1 => [   
'name' => 'Maria',  
'id' => '1' 
],  
2 => [  
'name' => 'Anon',  
'id' => '2'  
],  
);  

Will result in a table:

| Name| Id |
| Maria | 1 |
| Anon | 2 |

Creating links for column data

It is possible to create links for all cells in a column according to a linkpattern given in 'linkbase' and 'linkkey'. 'linkbase' is a static base url for the links and 'linkkey' can be defined to locate a key in the array or object $data.

Example

$columns = array([
  'name' => 'fruits',
  'label' => 'Fruits',

],
[
  'name' => 'animals',
  'label' => 'Animals',
  'linkbase' => 'https://en.wikipedia.org/wiki/',
  'linkkey' => 'animals',

],
);

$data = array(
  1 => [
  'fruits' => 'Apple', 
  'animals' => 'Horse' 
   ],
  2 => [
  'fruits' => 'Banana', 
  'animals' => 'Monkey' 
   ],
);

Converting column data

With the help of the method getDisplayVal($val, $displaytype, $format) it is possible to convert values from the array/object $data into another display value. This version supports converting true/false, 1/0, emtpy/not empty into simply "Yes" or "No". It also supports converting a date string into another date format.

$columns = array([
  'name' => 'date',
  'label' => 'Date',
  'display' => 'convert-datestr',
  'displayformat' => 'Y-m-d',
],
[
  'name' => 'title',
  'label' => 'Title',

],
[
  'name' => 'published',
  'label' => 'Published',
  'display' => 'yes-no',     
],
);

$data = array(
  1 => [
  'date' => '2015-05-15 12:14', 
  'title' => 'A blog post',
  'published' => true,
   ],
  2 => [
  'date' => '2015-05-16 13:15', 
  'title' => 'Another post',
  'published' => false,
   ],
);

Have a look at the example file simplehtmltable.php to see what creating links and converting data looks like.


All versions of chtmltable with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package meax/chtmltable contains the following files

Loading the files please wait ...