For Developers

Automate your conversions using the RebaseData API

Read MDF with PHP

Run the following command in your project folder to install the RebaseData PHP-Client using Composer:

composer require rebasedata/php-client "1.*"

Then you can read the MDF file using PHP. The following code sample at first defines the input files. Then it converts the input files so that they are readable. This might take a bit of time, since the operation is executed on the secure RebaseData servers. Finally the database table rows are printed. For more examples about how to use the library, check the README.

<?php

require 'vendor/autoload.php';

use RebaseData\Converter\Converter;
use RebaseData\InputFile\InputFile;

$inputFiles = [new InputFile('example.mdf')];

$converter = new Converter();
$database = $converter->convertToDatabase($inputFiles);
$tables = $database->getTables();

foreach ($tables as $table) {
  echo "Reading table '".$table->getName()."'\n";

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

How does it work?

The RebaseData PHP-Client internally uses our API to convert the MSSQL MDF file to a standardized format. Then you can read the data using PHP as shown above.

Why use RebaseData?

  • Strong security.
  • Works with Windows, Mac and Linux.
  • Use an API to convert your databases.
  • Professional support.

Terms

  • We don't guarantee for the success or correctness of the conversion
  • You are only allowed to convert your own database files
  • By using RebaseData, you agree to our general terms