PHPackages                             inok/dbf - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. inok/dbf

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

inok/dbf
========

Package for reading DBASE-files (FoxPro) with/without MEMO-fields

1.0.8(1y ago)1115.4k↓40%3[2 issues](https://github.com/nchizhov/inok-dbf/issues)1MITPHPPHP &gt;=5.6

Since Jan 18Pushed 1y ago1 watchersCompare

[ Source](https://github.com/nchizhov/inok-dbf)[ Packagist](https://packagist.org/packages/inok/dbf)[ Docs](https://blog.kgd.in)[ RSS](/packages/inok-dbf/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)DependenciesVersions (6)Used By (1)

DBF-file Reader Class
---------------------

[](#dbf-file-reader-class)

[![License](https://camo.githubusercontent.com/ff31346dabfe9b24107258f52875ae23777e563ec2a35b8af23368e5ebcdcdf9/68747470733a2f2f706f7365722e707567782e6f72672f696e6f6b2f6462662f6c6963656e7365)](https://packagist.org/packages/inok/dbf)[![License](https://camo.githubusercontent.com/d4544bb684c5c06d30c27a087fd3cef2061159b4694f510fe362b83c6ef8807f/68747470733a2f2f706f7365722e707567782e6f72672f696e6f6b2f6462662f762f737461626c65)](https://packagist.org/packages/inok/dbf)[![License](https://camo.githubusercontent.com/e0e56edf019b6f0df5bbebf749463a4446275bf899800c968ca99d1b77e53970/68747470733a2f2f706f7365722e707567782e6f72672f696e6f6b2f6462662f642f6d6f6e74686c79)](https://packagist.org/packages/inok/dbf)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/36dbfb98110e7f847ad576f261374163bd4155b10ca4109a6d38151a8af03d39/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6e6368697a686f762f696e6f6b2d6462662f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/nchizhov/inok-dbf/?branch=master)

### Description

[](#description)

This group of classes (**Table**, **Records**, **Memo** in namespace **Inok\\Dbf**) needs for reading DBF-files (structure, records) with/without MEMO-fields.

### Classes descriptions

[](#classes-descriptions)

#### Table

[](#table)

May read headers of: FoxBASE, dBASE III, dBASE IV, dBASE 5, dBASE 7 (*partial*), FoxPro, FoxBASE+, Visual FoxPro file structure.

##### Using:

[](#using)

```
$table = new \Inok\Dbf\Table(/path/to/dbf/file, $charset);
```

where `$charset` only using, when charset in dbf-file not defined (default charset: **866**)

##### Methods:

[](#methods)

- `$table->getHeaders()` - return array of DBF-file headers
- `$table->getColumns()` - return array of DBF-file columns
- `$table->getData()` - return resource to DBF-file body (required for **Inok\\Dbf\\Records**)
- `$table->error` - return boolean true if in DBF-file errors in headers or columns
- `$table->error_info` - returns error description or **null** - if no errors
- `$table->close()` - close DBF-file (also closing on destruct class)

#### Records

[](#records)

May read records of: FoxBASE, dBASE III, dBASE IV, dBASE 5, dBASE 7, FoxPro, FoxBASE+, Visual FoxPro file records. Now implements column types:

- **C** - Character
- **D** - Date as string in format 'YYYYMMDD' (if empty converts to null)
- **F** - Float (if empty converts to null)
- **G** - General (OLE)
- **L** - Logical ('t', 'y', 'д' - converts to 1, '?' - converts to null, all others to 0)
- **M** - Memo
- **N** - Numeric (if empty converts to null)
- **P** - Picture
- **T** - DateTime as string in format 'YYYYMMDDHHIISS' (if empty converts to null)
- **@** - DateTime as string in format 'YYYYMMDDHHIISS' (if empty converts to null)
- **I** - Integer
- **Y** - Currency
- 0 - NullFlags as integer

Not supported types:

- **B**:
    - dBase 5 (Binary) - block num in MEMO-file (10 digits, padded right with spaces). Empty value: 10 spaces
    - Visual FoxPro (Double) - float 8-byte binary format [IEEE 754](https://ru.wikipedia.org/wiki/IEEE_754). Empty values - zero
- **O**:
    - dBase 7 (Double) - float 8-byte format [IEEE 754](https://ru.wikipedia.org/wiki/IEEE_754). Bytes inverse, for negative numbers - inverse all bits, for positive - sign bit only. Empty values - zero
- **Q**:
    - Visual FoxPro (Varbinary) - Binary data with variable data. Start part saved in DBF-file, other part with variable lenth - in MEMO-file
- **V**:
    - Visual FoxPro (Varchar) - String with variable length. Start part saved in DBS-file, other part with variable length - in MEMO-file.
- **W**
    - Visual FoxPro (Blob) - No info about format
- **+**
    - dBase 7 (Autoincrement) - Signed integer in binary format. Length - 4 bytes BE.

##### Using:

[](#using-1)

```
$records = new \Inok\Dbf\Records($data, $encode, $headers, $columns);
```

- **$data** - Instance of Table class or DBF-file resource from Inok\\Dbf\\Table getData()
- **$encode** - iconv **Memo, Character** fields to selected character (default: **utf8**)
- **$headers** - DBF-file headers array or null if $data is instance of Table class (default: null)
- **$columns** - DBF-file columns array or null if $data is instance of Table class (default: null)

##### Methods:

[](#methods-1)

- `$record->nextRecord` - reads next record from DBF-file (return record-array or false - if records finished)

#### Memo

[](#memo)

May read MEMO-files formats (headers and records): DBT, FPT, SMT

##### Using:

[](#using-2)

```
$memo = new \Inok\Dbf\Memo(/path/to/dbf/memo/file);
```

##### Methods:

[](#methods-2)

- `$memo->getHeaders()` - returns array of MEMO-file headers
- `$memo->readMemo($record)` - return array of MEMO `$record` position
- `$memo->close()` - close MEMO-file (also closing on destruct class)

### Notes

[](#notes)

##### Table header array:

[](#table-header-array)

- **dbf\_file** - path to DBF-file
- **table** - DBF-table name in lowercase
- **version** - DBF-file version
- **version\_name** - DBF-file version text description
- **date** - DBF-file last change date in *d.m.Y*-format (years between 1970 - 2069)
- **records** - Number of records in DBF-file
- **record\_length** - One record length (in bytes) in DBF-file
- **unfinished\_transaction** - Flag of unfinished transactions in DBF-file
- **coded** - Flag of coded *dBASE IV* database
- **mdx\_flag** - Flag of index MDX-file
- **charset** - Charset identifier of DBF-file records
- **charset\_name** - Normal charset name of DBF-file records
- **memo** - If *True* - DBF-file have MEMO-fields
- **memo\_file** - MEMO-file path if DBF-file have MEMO-fields

##### Column header array:

[](#column-header-array)

- **name** - column name in lowercase
- **type** - column type (one char)
- **length** - column length
- **decimal** - if not 0 - decimal part of number
- **mdx\_flag** - MDX-flag on column (except *Visual FoxPro*)
- **auto\_increment** - next auto increment value (only for *dBASE 7*, *Visual FoxPro*)
- **system** - column is system (only for *Visual FoxPro*)
- **has\_null** - column can story null values (only for *Visual FoxPro*)
- **binary** - column for *CHAR* and *MEMO* only (only for *Visual FoxPro*)
- **auto\_increment\_next** - next value for auto increment (only for *Visual FoxPro*)
- **auto\_increment\_step** - step value for auto increment (only for *Visual FoxPro*)

##### MEMO-file header array:

[](#memo-file-header-array)

- **freeblock\_position** - position of next free block of MEMO-file
- **block\_size** - MEMO-file block size (*if exists*)
- **dbf-file** - DBF-file name (*if exists*)

##### MEMO-record header array:

[](#memo-record-header-array)

- **signature** - type of MEMO-record: text or template (*if exists*)
- **length** - size of MEMO-record (*if exists*)
- **text** - text of MEMO-record

### License

[](#license)

This package is released under the **MIT license**.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~724 days

Total

5

Last Release

513d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ce0f496c0c04c90c29675b08f834ad58707bc8e3498e1693e198e23e0b3e5871?d=identicon)[nchizhov](/maintainers/nchizhov)

---

Top Contributors

[![nchizhov](https://avatars.githubusercontent.com/u/4849753?v=4)](https://github.com/nchizhov "nchizhov (1 commits)")

---

Tags

dbfdbasefoxpromemo

### Embed Badge

![Health badge](/badges/inok-dbf/health.svg)

```
[![Health](https://phpackages.com/badges/inok-dbf/health.svg)](https://phpackages.com/packages/inok-dbf)
```

###  Alternatives

[hisamu/php-xbase

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

1871.5M2](/packages/hisamu-php-xbase)[phpmyadmin/shapefile

ESRI ShapeFile library for PHP

281.4M1](/packages/phpmyadmin-shapefile)[org.majkel/dbase

Library to access dbase / xbase / dbf database files

33100.7k1](/packages/orgmajkel-dbase)[nikaia/nova-rating-field

Add start rating field to Laravel Nova

42258.6k](/packages/nikaia-nova-rating-field)[totalcrm/php-dbf

A simple parser for \*.dbf files using PHP

1023.6k](/packages/totalcrm-php-dbf)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
