- How do I install yajra/laravel-oci8 for Laravel 9.x?
- Run `composer require yajra/laravel-oci8:^13` to install the latest version. Laravel 9.x is explicitly supported, and the package will auto-discover the service provider if you’re using Laravel 5.5+. No additional steps are needed unless you want to publish the config file.
- What PHP and Oracle versions does this package support?
- The package works with PHP 7.4–8.3 and Oracle Database versions 11g through 21c. Ensure the PHP OCI8 extension is installed (`pecl install oci8`) and configured in `php.ini` before using it. Oracle 12c+ features like JSON queries require the corresponding Oracle version.
- Can I use Eloquent and Query Builder with Oracle via this package?
- Yes, yajra/laravel-oci8 fully extends Laravel’s database layer, so Eloquent models and Query Builder queries work out of the box. Oracle-specific quirks (e.g., sequences, triggers) are handled automatically, though complex migrations may need manual adjustments.
- How do I configure the connection for Oracle in Laravel?
- Add the connection details to your `.env` file under `DB_CONNECTION=oracle`, `DB_HOST=your_host`, `DB_PORT=1521`, `DB_DATABASE=your_db`, `DB_USERNAME=user`, and `DB_PASSWORD=pass`. Optionally, publish the config with `php artisan vendor:publish --tag=oracle` for advanced tuning.
- Does this package support JSON queries in Oracle 12c+?
- Yes, the package includes Oracle-specific JSON methods like `whereJsonContains` and `whereJsonBoolean` for read operations. Write operations (updating JSON) are not natively supported and require application-layer handling or custom queries.
- Will my existing Laravel migrations work with Oracle?
- Most basic migrations will work, but Oracle has stricter syntax rules (e.g., no `AUTO_INCREMENT`, uses sequences instead). Complex migrations involving constraints or triggers may need refactoring. Test migrations thoroughly in a staging environment before production.
- How do I handle case-sensitive Oracle usernames/passwords in Laravel’s Auth?
- Laravel’s Auth system defaults to case-insensitive checks, but Oracle usernames are case-sensitive. Override the `AuthManager` or use a custom `OracleUserProvider` to handle case-sensitive authentication. The package itself doesn’t modify Auth behavior.
- Can I use this package with Lumen?
- Yes, yajra/laravel-oci8 is explicitly compatible with Lumen. Register the service provider in `bootstrap/app.php` and configure the Oracle connection in `config/database.php` just like in Laravel. No additional Lumen-specific setup is required.
- What are the performance considerations for Oracle vs. MySQL/PostgreSQL?
- Oracle’s OCI protocol may introduce slight latency compared to local databases. For high-traffic apps, enable connection pooling with `DB::reconnect()` or use Oracle’s `DB_LOAD_BALANCE` for read operations. Monitor query performance with `log_query_time` in your config.
- Are there alternatives to yajra/laravel-oci8 for Oracle in Laravel?
- Other options include `laravel-oracle` (older, less maintained) or writing custom database drivers. However, yajra/laravel-oci8 is the most actively maintained, Laravel-idiomatic solution with broad version support and Oracle-specific optimizations like JSON queries and schema builder extensions.