Download the PHP package naril/dbase without Composer
On this page you can find all versions of the php package naril/dbase. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package dbase
Short Description Library to access dbase / xbase / dbf database files
License MIT
Homepage https://github.com/majkel89
Informations about the package dbase
dbase
Library for processing dbase tables.
Table of Contents
- Supported formats
- Supported memo formats
- Installation
- Documentation
- Reading tables
- Inserting rows
- Automatic type conversion
- Record object
- Reading data from record
- Writing data to record
- Record object
- Updating tables
- Deleting records
- Transactions
- Defining tables
- Creating table from another table
- Filters
- Using filters
- Writing custom filter
Supported formats
- dBASE III
- dBASE III PLUS
Supported memo formats
- DBT
- FPT
Installation
Composer
Using composer to install this library is strongly recommended.
`
Then in your script use this line of code
``
Old-fashion style
Download library and place it somewhere on disk.
Then in your script use this line of code
``
Documentation
Reading tables
Table object is both array accessible and traversable. You can loop over it as collection or read specific record by it's index.
``
Inserting rows
You can insert records as record object or as an associative array.
Note that insert operation is not atomic. Use transactions to achieve integrity safety.
`
Automatic type conversion
Dbase and PHP types are automatically converted during fetching and storing of rows.
Dbase type | Type name | Possible values | PHP type |
---|---|---|---|
C | Character | any string | string |
D | Date | DDMMYY | DateTime |
L | Logical | [YTNF?] | boolean |
M | Memo | any string | string |
N | Numeric | [0-9] | int |
Record object
Record is basically ArrayObject. Object that can be treated as array.
Reading data from record
``
Writing data to record
``
Updating tables
Note that update operation is not atomic. Use transactions to achieve integrity safety.
``
Deleting records
Do not use
Record::setDeleted
to delete records
``
Transactions
Transactions can prevent two processes from updating the same file.
When some process cannot acquire lock on the table exception is being thrown.
Transactions can also save you from unnecessary header updates. Header is updated at the end of transaction.
``
Defining tables
To construct new table use builder object.
``
Creating table from another table
You can create new table form existing table definition.
`
Filters
Although values are automatically converted based on column type sometimes it is necessary to perform additional processing. To achieve that you can add filters on columns.
Using filters
``
Filters are applied during loading in the order they are defined. During serialization filters are applied in reversed order.
Writing custom filter
``