2017 © Pedro Peláez
 

library structure-files

image

wwtg99/structure-files

  • Thursday, July 28, 2016
  • by wwtg99
  • Repository
  • 1 Watchers
  • 0 Stars
  • 70 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

StructureFiles

A common interface for Section structure files and wrappers for downloading and printing in browser.

Section structure

  • section name, optional
  • section head, optional
  • section body, required

Section type

  • key value (kv)
key1 value1
key2 value2
  • Table (tsv)
field1 field2 field3
value1 value2 value3
value4 value5 value6
  • Raw two dimension array

Examples

$name = 'name1';
// body [['field1'=>'', 'field2'=>'', ...], ...]
$data = [['f1'=>'v1', 'f2'=>'v2'], ['f1'=>'v3', 'f2'=>'v4']];
// head [['title'=>'', 'field'=>'', 'type'=>''], ...]
$head = [['title'=>'t1', 'field'=>'f1', 'type'=>'string'], ['title'=>'t2', 'field'=>'f2', 'type'=>'int']];
// rule
$rules = [];
$s = new Section(Section::KV_SECTION, $name, $data, $head, $rules);
// SectionFile is a list of Section
$sf = new SectionFile([$s1]);
Rules
  • showHead: bool, default true
  • showName: bool, default true
  • null: string, default '-', string to show if value is null
  • skip: array, default [], skip fields
  • prefix: string, default '', prefix added before each line
  • postfix: string, default '', postfix added after each line
  • del: string, default '\t', delimiter between each fields
Use SectionFile class to create txt file or excel file
$txt1 = TxtFile::createFromSection($sf);
$excel1 = ExcelFile::createFromSection($sf);
// Download in browser
$excel1->download();
// Print to browser if supported
$txt1->printContent();

The Versions

28/07 2016

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

28/07 2016

0.2.0

0.2.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

22/04 2016

0.1.3

0.1.3.0

  Sources   Download

MIT

The Requires

 

The Development Requires

13/04 2016

0.1.2

0.1.2.0

  Sources   Download

MIT

The Requires

 

The Development Requires

07/04 2016

0.1.1

0.1.1.0

  Sources   Download

MIT

The Requires

 

The Development Requires

02/03 2016

0.1.0

0.1.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires