A modern Oracle Database ecosystem for PHP: a typed API with full PL/SQL fidelity, a native Rust thin extension, and a Laravel adapter.
A community project, not affiliated with, endorsed by or sponsored by Oracle.
Note
The project is 0.x: the API may break between minor versions. Require a minor version (^0.1) and read the changelogs before upgrading.
pie install openrajska/php-oracledb-ext # the oracledb extension, a pre-built binary (PIE 1.4.0 or newer)
composer require openrajska/php-oracledb # Core, the typed APIPIE downloads a binary for PHP 8.4, NTS or ZTS, and never compiles. Binaries exist for:
| OS | Architectures | Notes |
|---|---|---|
| Linux, glibc | x86_64, arm64 | glibc 2.36 or newer (Debian 12 bookworm and later) |
| Linux, musl | x86_64, arm64 | Alpine, such as the official php:8.4-*-alpine images |
| macOS | arm64 |
There is none for Windows, macOS Intel or a glibc older than 2.36 (Ubuntu 22.04, RHEL and Oracle Linux 8 and 9, Amazon Linux 2023). On Windows PIE refuses the package; on macOS Intel it fails when it finds no matching binary; on an older glibc it installs the glibc binary anyway, and PHP may then fail to load it.
In CI and Docker builds PIE also needs a GitHub token, unzip and --no-build-tools-check: see Installing the extension in CI. Core's README has the quick start.
Talking to Oracle from PHP today means oci8 or PDO_OCI. Both need Oracle Instant Client installed and the extension compiled against it. On top of that, PDO cannot represent the ways PL/SQL returns data: several REF CURSORs per Call, typed OUT and IN OUT parameters, Implicit results, Collections and object types.
This project aims for:
- A typed API instead of a PDO driver, so that PL/SQL works without losing data or types (ADR 0001).
- No Instant Client and nothing to compile. The native extension ships as pre-built binaries installed with PIE, on top of a thin (pure network protocol) driver.
- Interchangeable Backends behind one Driver contract, so the same code runs on the native extension or on a pure-PHP fallback.
- A Laravel adapter that keeps
DB::listen, Telescope and Pulse working.
The first target is PHP 8.4.
| Package | What it is | Status |
|---|---|---|
openrajska/php-oracledb |
Core: the typed API users call and the Driver contract Backends implement (docs, changelog) | 0.1 |
openrajska/php-oracledb-ext |
The oracledb PHP extension, hosting the Rust thin Backend (docs, changelog) |
0.1 |
openrajska/laravel-oracledb |
Integrates Core into Laravel's database layer | planned |
Each package is published from a read-only split repository of the same name; issues and pull requests go here.
The shared vocabulary (Backend, Call, Implicit result, Collection…) is defined in the glossaries.
The Rust thin Backend, built on Oracle's oracledb crate, is the Primary Backend (ADR 0002). The spike that decided it is in spikes/rust-oracledb/, and the plan lives in the wayfinder map.
packages/ the Composer and PIE packages
spikes/ throwaway experiments; never shipped
fixtures/tls/ certificates and listeners for the TLS tests
docs/adr/ architecture decision records
docs/research/ background research (in Portuguese)
Everything runs in ddev: PHP 8.4, Rust and an ephemeral Oracle Database 26ai Free. Nothing besides ddev and Docker is needed on the host.
ddev start
ddev cargo build # cargo inside the web containerSee CONTRIBUTING.md for the environment and the commit conventions.
Licensed under either of
- MIT license (LICENSE-MIT)
- Apache License, Version 2.0 (LICENSE-APACHE)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. This project is independent and is not affiliated with, endorsed by or sponsored by Oracle.