Modern PHP binding for the OpenADS database engine. Wraps the ACE C library through PHP's FFI extension — no compiled C code, install with Composer.
- PHP 8.1 or newer
ext-ffienabled (ffi.enable=1inphp.ini)- An OpenADS ACE library reachable on the host:
ace64.dll/ace32.dll(Windows) orlibace64.so/libace32.so(Linux/macOS). PointOPENADS_ACE_LIBat it, or place it on the system library path.
composer require openads/openads-phpLocal data directory:
use OpenADS\Connection;
$conn = new Connection('/var/data/myapp');Remote openads_serverd:
$conn = new Connection('tcp://db.example.com:6262/myapp', 'user', 'pass');$stmt = $conn->statement();
$cursor = $stmt->query(
'SELECT * FROM people WHERE name = ?',
["O'Brien"] // quoted safely; never concatenate
);
foreach ($cursor as $row) {
echo $row['NAME'], "\n";
}Named parameters work too: :id with [':id' => 5].
$table = $conn->table('people');
for ($table->gotoTop(); !$table->atEof(); $table->skip(1)) {
echo $table->record()->get('NAME'), "\n";
}$rec = $conn->table('people')->record();
$rec->append();
$rec->set('ID', 42);
$rec->set('NAME', 'Reinaldo');
$rec->save();Apache-2.0. See the repository LICENSE.