Download the PHP package chvila/php-xbase without Composer
On this page you can find all versions of the php package chvila/php-xbase. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download chvila/php-xbase
More information about chvila/php-xbase
Files in chvila/php-xbase
Package php-xbase
Short Description A simple parser for *.dbf, *.fpt files using PHP
License MIT
Homepage https://github.com/hisamu/php-xbase
Informations about the package php-xbase
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.
Installation
You can install it through Composer:
Sample usage
If the data in DB is not in UTF-8 you can specify a charset to convert the data from:
It is also possible to read Memos from dedicated files. Just make sure that .fpt file with the same name as main database exists
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.
If you know the column type already, you can also call the type-specific function for that field, which increases the speed too.
Writing Data
To open a table for writing, you have to use a WritableTable
object, as on this example:
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.