- Can I use this bundle in a Laravel project even though it’s for Symfony?
- No, this bundle is specifically designed for Symfony and won’t work directly in Laravel. Laravel has its own ecosystem (e.g., Eloquent, Query Builder) that isn’t compatible with Symfony’s dependency injection or bundle system. However, you could adapt the underlying `bisonlab/noorm` library for Laravel if you need a lightweight NoORM solution.
- What Laravel alternatives exist for lightweight database access without Doctrine?
- For Laravel, consider using raw PDO, Laravel’s built-in Query Builder, or packages like `spatie/laravel-query-builder` for fluent SQL queries. If you need a NoORM approach, you could also explore `cycle/orm` (though it’s more complex) or build a custom wrapper around PDO. The `bisonlab/noorm` library itself could be adapted for Laravel with minimal effort.
- How do I install and configure this bundle in Symfony?
- Install via Composer with `composer require bisonlab/noorm-bundle`, then enable the bundle in your `config/bundles.php`. Configure database connections in `config/packages/doctrine.yaml` (or your preferred config format) and define NoORM services in `config/services.yaml`. The bundle provides minimal setup—just point it to your PDO connection and start querying tables directly.
- Does this bundle support Laravel’s Eloquent relationships or Doctrine associations?
- No, this bundle is a NoORM solution, meaning it intentionally avoids ORM features like relationships, hydration, or associations. If you need those, stick with Eloquent or Doctrine. For simple queries, joins, or raw data access, this bundle offers a faster, lighter alternative without the overhead.
- Will this bundle work with Laravel’s database migrations?
- No, this bundle is for Symfony and doesn’t integrate with Laravel’s migration system. However, you can use Laravel’s native migrations or tools like `doctrine/dbal` (which works in both frameworks) to manage schema changes. The bundle itself only handles queries, not migrations or schema definitions.
- Is this bundle suitable for high-traffic APIs or read-heavy applications?
- Yes, this bundle is optimized for performance-critical scenarios like APIs, analytics, or reporting. It avoids ORM abstractions, reducing query overhead and memory usage. However, you’ll need to manually optimize queries (e.g., batching, indexing) since it lacks built-in lazy-loading or caching layers.
- Can I use this with PostgreSQL, MongoDB, or other non-relational databases?
- The bundle works with any PDO-supported database (MySQL, PostgreSQL, SQLite, etc.), but it’s primarily designed for relational databases. For NoSQL like MongoDB, you’d need to use a dedicated driver (e.g., `mongodb/mongodb`) and avoid this bundle entirely, as it’s built for SQL-like queries.
- How do I handle transactions or connection pooling with this bundle?
- Transactions must be managed manually via Symfony’s `DatabaseConnection` or PDO. For connection pooling, configure your database server (e.g., PostgreSQL’s `pgbouncer`) or use a connection manager like `pdo_pgsql` with persistent connections. The bundle doesn’t abstract these concerns, so you’ll need to handle them at the database level.
- Are there any security risks I should be aware of when using raw SQL queries?
- Yes, raw SQL queries expose you to SQL injection risks if not properly sanitized. Always use parameter binding (e.g., `where(['active' => true])`) instead of string interpolation. For dynamic queries, consider a query builder like Symfony’s `QueryBuilder` or a whitelist of allowed columns/tables to mitigate risks.
- What’s the maintenance status of this bundle, and should I use it in production?
- The bundle has low community activity (6 stars, 0 dependents), so maintenance risks are higher. However, the underlying `bisonlab/noorm` library is stable and well-tested. For production, thoroughly test your queries, monitor performance, and consider forking the bundle if you need long-term support. Always check Symfony version compatibility.