- Can I use this bundle directly in Laravel without Symfony?
- No, this bundle is designed for Symfony and requires its dependency injection system. However, you can extract the core OGM logic (document mapping, query builder) and adapt it for Laravel using a ServiceProvider or standalone library. This would involve replacing Symfony dependencies with Laravel equivalents.
- What’s the best way to integrate ArangoDB OGM functionality in Laravel?
- The most practical approach is to create a standalone Laravel package by forking the bundle and removing Symfony-specific dependencies. Replace them with Laravel’s ServiceContainer, Facades, and Eloquent-like model structures. This way, you retain the OGM benefits (e.g., relationships, migrations) while avoiding Symfony’s overhead.
- Does this bundle support Laravel’s Eloquent ORM patterns?
- Not natively, but you can build compatibility by extending Laravel’s Model class and integrating the bundle’s query builder. For example, you could create a custom trait or base model that bridges the OGM’s fluent API with Eloquent’s conventions. This would require manual mapping of features like relationships and migrations.
- What Laravel versions does this bundle support after adaptation?
- The bundle’s core PHP version (likely 7.4+) may align with Laravel 8.0+, but Symfony dependencies could cause conflicts. After refactoring, ensure compatibility by testing with Laravel’s latest LTS version (e.g., 10.x) and PHP 8.1+. You may need polyfills for Symfony components if Laravel lacks native equivalents.
- How do I handle ArangoDB relationships (edges) in Laravel with this bundle?
- The bundle’s edge support can be preserved by adapting its relationship logic into Laravel. For example, you could create a custom `HasEdges` trait for Eloquent models that translates the OGM’s graph queries into Laravel-compatible syntax. This would allow you to query connected documents (vertices) efficiently, similar to Eloquent’s `hasMany` but for graph data.
- Is it better to use this OGM or the raw arangodb/arangodb-php driver in Laravel?
- Use the raw driver if you need fine-grained control, performance optimization, or simple CRUD operations. Opt for the OGM if you prioritize rapid development, built-in relationships, or complex graph queries. A hybrid approach—using the OGM for models and the raw driver for critical paths—can balance both needs.
- How do I migrate existing ArangoDB collections to this OGM in Laravel?
- After adapting the bundle, you can use its migration system (if preserved) to manage collections and schemas. For Laravel, create a custom migration class that extends the OGM’s migration logic and integrates with Laravel’s migration system. Alternatively, manually map existing collections to Laravel models using the OGM’s annotations or configuration.
- Are there performance trade-offs compared to using the raw ArangoDB driver?
- Yes, the OGM adds abstraction layers (e.g., model mapping, query building) that may introduce overhead. Benchmark critical queries against the raw driver to assess the impact. Optimize by caching frequent queries, using raw driver calls for performance-critical paths, or tuning the OGM’s configuration.
- What alternatives exist for ArangoDB in Laravel besides this bundle?
- Consider the raw `arangodb/arangodb-php` driver for full control, or lightweight ORMs like `jenssegers/arangodb` (Laravel-specific). For graph-heavy applications, evaluate custom solutions using Laravel’s Model traits or query builder extensions. Each alternative trades off convenience, performance, and feature parity.
- How do I test this bundle in a Laravel project before full integration?
- Start by forking the bundle and replacing Symfony dependencies with Laravel equivalents in a test project. Use Laravel’s `ServiceProvider` to register the OGM’s core services, then test basic functionality: model creation, collection mapping, and simple queries. Gradually add complex features like relationships and migrations, ensuring compatibility with Laravel’s testing tools (e.g., PHPUnit, Pest).