Read Visual FoxPro with PHP


Run the following command in your project folder to make Composer install the RebaseData PHP API client.

composer require rebasedata/php-client

Then you can read the Visual FoxPro files. By using 'freemium' as api key, you can convert files within the Freemium limits. Keep in mind that when you first read the database, it can take a while depending on the database size. Here the first read is the getDatabaseTables() call.


require 'vendor/autoload.php';

use RebaseData\Client;

$client = new Client('freemium');

$inputFiles = ['northwind.dbc', 'northwind.dct', 'northwind.dcx', 'categories.dbf', 'categories.cdx', 'categories.fpt'];

$tables = $client->getDatabaseTables($inputFiles);
foreach ($tables as $table) {
  echo "Reading table $table\n";

  $rows = $client->getDatabaseTableRows($inputFiles, $table);
  foreach ($rows as $row) {
    echo implode(', ', $row)."\n";

How does it work?

The RebaseData PHP client library internally uses our API to convert the Visual FoxPro files to a set of CSV files. These CSV files, one per table, will be cached locally to allow fast reads on the second access. In case the input file changes, a new conversion will be triggered.

Why use RebaseData?