2017 © Pedro PelĆ”ez
 

library php-xbase

A simple parser for *.dbf, *.fpt files using PHP

image

chvila/php-xbase

A simple parser for *.dbf, *.fpt files using PHP

  • Monday, October 30, 2017
  • by ChvilaMartin
  • Repository
  • 1 Watchers
  • 0 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 51 Forks
  • 0 Open issues
  • 8 Versions
  • 7 % Grown

The README.md

PHP XBase

A simple library for dealing with dbf databases like dBase and FoxPro. It's a port of PHPXbase class written by Erwin Kooi, updated to a PSR-2 compliant code and tweaked for performance and to solve some issues the original code had., (*1)

Installation

You can install it through Composer:, (*2)

$ composer require hisamu/php-xbase

Sample usage

``` php <?php, (*3)

use XBase\Table;, (*4)

$table = new Table(dirname(FILE).'/test.dbf');, (*5)

while ($record = $table->nextRecord()) { echo $record->my_column; }, (*6)


If the data in DB is not in UTF-8 you can specify a charset to convert the data from: ``` php $table = new Table(dirname(__FILE__).'/test.dbf', null, 'CP1251');

It is also possible to read Memos from dedicated files. Just make sure that .fpt file with the same name as main database exists, (*7)

Performance

You can pass an array of the columns that you need to the constructor, then if your table has columns that you don't use they will not be loaded. This way the parser can run a lot faster., (*8)

``` php <?php, (*9)

use XBase\Table;, (*10)

$table = new Table(dirname(FILE).'/test.dbf', array('my_column', 'another_column'));, (*11)

while ($record = $table->nextRecord()) { echo $record->my_column; echo $record->another_column; }, (*12)


If you know the column type already, you can also call the type-specific function for that field, which increases the speed too. ``` php while ($record = $table->nextRecord()) { echo $record->getChar('my_column'); echo $record->getDate('another_column'); }

Writing Data

To open a table for writing, you have to use a WritableTable object, as on this example:, (*13)

``` php <?php, (*14)

use XBase\WritableTable;, (*15)

$table = new WritableTable(dirname(FILE).'/test.dbf')); $table->openWrite();, (*16)

for ($i = 0; $i < 10; $i++) { $record = $table->nextRecord(); $record->field = 'string'; $table->writeRecord(); }, (*17)

optional

$table->close(); ```, (*18)

Troubleshooting

I'm not an expert on dBase and I don't know all the specifics of the field types and versions, so the lib may not be able to handle some situations. If you find an error, please open an issue and send me a sample table that I can reproduce your problem and I'll try to help., (*19)

The Versions

30/10 2017

dev-master

9999999-dev https://github.com/hisamu/php-xbase

A simple parser for *.dbf, *.fpt files using PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Luã de Souza

dbase foxpro

30/10 2017

1.0.51

1.0.51.0 https://github.com/hisamu/php-xbase

A simple parser for *.dbf, *.fpt files using PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Luã de Souza

dbase foxpro

09/01 2017

1.0.5

1.0.5.0 https://github.com/hisamu/php-xbase

A simple parser for *.dbf, *.fpt files using PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Luã de Souza

dbase foxpro

05/01 2017

1.0.4

1.0.4.0 https://github.com/hisamu/php-xbase

A simple parser for *.dbf, *.fpt files using PHP

  Sources   Download

The Requires

  • php >=5.3.0

 

by Luã de Souza

dbase foxpro

14/12 2016

1.0.3

1.0.3.0 https://github.com/hisamu/php-xbase

A simple parser for *.dbf, *.fpt files using PHP

  Sources   Download

The Requires

  • php >=5.3.0

 

by Luã de Souza

dbase foxpro

07/11 2016

1.0.2

1.0.2.0 https://github.com/hisamu/php-xbase

A simple parser for *.dbf, *.fpt files using PHP

  Sources   Download

The Requires

  • php >=5.3.0

 

by Luã de Souza

dbase foxpro

19/04 2016

1.0.1

1.0.1.0 https://github.com/hisamu/php-xbase

A simple parser for *.dbf files using PHP

  Sources   Download

The Requires

  • php >=5.3.0

 

by Luã de Souza

dbase foxpro

13/04 2016

1.0.0

1.0.0.0 https://github.com/hisamu/php-xbase

A simple parser for *.dbf files using PHP

  Sources   Download

The Requires

  • php >=5.3.0

 

by Luã de Souza

dbase foxpro