- How do I install yajra/laravel-oci8 in a Laravel application?
- Run composer require yajra/laravel-oci8:^13, choosing the package version that matches your Laravel release. Install and enable the OCI8 PHP extension plus Oracle Instant Client libraries first. On Laravel 5.5+ the Oci8ServiceProvider is auto-discovered; older versions require manual registration, then add an oracle connection in config/database.php.
- Which Laravel versions does yajra/laravel-oci8 support?
- The package ships matching releases for Laravel 5.1 through 13.x, so pick the package version aligned with your framework version. Test migrations and edge cases on your exact Laravel and Oracle combination, since third-party packages may assume MySQL or PostgreSQL behavior.
- How do I configure an Oracle connection in Laravel's config/database.php?
- Add an entry with driver set to oracle and include host, port, database (service name or SID), username, password, charset, and optional prefix or schema. You can override credentials at runtime with callbacks for multi-tenant or role-based Oracle access. Keep TNS and pooling settings aligned with your Oracle client configuration.
- Do I need the OCI8 PHP extension to use Oracle with Laravel?
- Yes. Install it with pecl install oci8 or your platform package and enable it in php.ini, and make sure it matches your Oracle client version, using 12c or newer for JSON support. Version mismatches can cause connection errors or SQL syntax failures.
- Does yajra/laravel-oci8 support Laravel migrations and the schema builder?
- Yes, it extends Illuminate/Database to provide Oracle-specific grammar and schema handling for migrations. Watch Oracle's 30-character identifier limit (128 in 12c+) and use IDENTITY columns or sequences instead of AUTO_INCREMENT. Prefix management via DB_PREFIX_SCHEMA can help avoid naming conflicts.
- How does yajra/laravel-oci8 handle JSON columns?
- JSON is read-only on Oracle 12c+ through this driver, and updates require replacing the full document. Recent releases improve nested JSON path compilation for functions such as JSON_LENGTH. Test mixed read and write JSON code paths explicitly in staging.
- Can I use Laravel soft deletes and timestamps with Oracle?
- Yes, but Oracle defaults to case-sensitive queries and trigger-based deleted_at soft deletes can fail if triggers are scoped incorrectly. Define timestamps and nullable columns explicitly in migrations. Verify behavior for packages that assume MySQL timestamp semantics.
- How do I set up yajra/laravel-oci8 in Lumen?
- Lumen does not auto-discover the service provider, so manually register Oci8ServiceProvider and add the oracle connection array to config/database.php. Confirm the OCI8 extension and Oracle client libraries are installed in the Lumen runtime. Then test migrations and Eloquent queries as you would in Laravel.
- Does yajra/laravel-oci8 support PHPStan and Larastan?
- Yes, the package includes an optional PHPStan/Larastan extension for OCI8-specific DB methods. Include vendor/yajra/laravel-oci8/extension.neon in your phpstan.neon to have those methods recognized. This improves static analysis for Oracle-only calls without changing runtime behavior.
- What are the alternatives to yajra/laravel-oci8 for Oracle in Laravel?
- yajra/laravel-oci8 is the de facto Oracle driver because it extends Illuminate/Database with grammar, schema, and migration support. Alternatives such as raw OCI8 code or PDO_OCI wrappers lack Laravel's query builder and migration integration. Custom drivers require significant work to match Eloquent and schema behavior.