- How does this package differ from Laravel’s built-in `DB::transaction()`?
- This package provides dialect-agnostic transaction abstractions shared across multiple database adapters, making it ideal for applications using PostgreSQL, MySQL, and SQLite simultaneously. Laravel’s `DB::transaction()` is database-specific and tied to Eloquent/Query Builder, while this package centralizes transaction logic for reuse in microservices or polyglot persistence environments.
- Can I use this with Laravel’s Eloquent models?
- The package focuses on SQL transaction abstractions rather than Eloquent-specific features. You’ll need to wrap Eloquent operations manually or create custom decorators to integrate it with Eloquent’s transaction handling. Check if AEATech provides extensions for Eloquent in their broader ecosystem.
- Which Laravel versions and PHP versions are supported?
- The package’s documentation doesn’t specify Laravel/PHP versions, but it’s written in modern PHP. For compatibility, ensure your Laravel version (e.g., 8.0+) aligns with the package’s PHP requirements (likely 8.0+). Test with your target Laravel version to confirm no deprecated function conflicts.
- Does this package handle distributed transactions or sagas?
- This package provides dialect-agnostic SQL transaction implementations but isn’t designed for distributed transactions or saga patterns. It’s part of AEATech’s broader Transaction Manager ecosystem, which may include those features. Verify if the package integrates with AEATech’s distributed transaction tools.
- How do I integrate this into an existing Laravel project?
- Install via Composer (`composer require aeatech/transaction-manager-common-transactions`), then register the package’s service provider in `config/app.php`. Replace or extend Laravel’s `DB::transaction()` with the package’s abstractions where dialect-agnostic behavior is needed. Use Laravel’s event system to hook into transaction lifecycle events (e.g., `begin`, `commit`).
- Will this work with Laravel Queues or Horizon?
- The package doesn’t natively support Laravel Queues, but you can manually wrap queue jobs with its transaction abstractions. For Horizon, ensure your queue workers use the package’s transaction manager instead of Laravel’s default. Test thoroughly, as queue transactions may introduce deadlocks or performance overhead.
- Are there performance trade-offs compared to raw PDO transactions?
- The abstraction layer adds minimal overhead, but dialect-agnostic logic may introduce slight latency for complex transactions (e.g., nested transactions, SAVEPOINTs). Benchmark against Laravel’s `DB::transaction()` for your specific use cases, especially in high-throughput environments like batch processing.
- How do I handle database-specific SQL features (e.g., SAVEPOINT, isolation levels)?
- The package abstracts common transaction patterns but may not support all dialect-specific features uniformly. For advanced SQL features, you’ll need to extend the package or use raw PDO queries where necessary. Check the package’s documentation for supported features and limitations across databases.
- Is this package actively maintained? What’s the risk of using it?
- With 0 stars and no visible maintenance activity, this package carries higher risk. Verify if AEATech is actively developing it or if it’s a legacy component. Consider alternatives like Laravel’s built-in tools or Doctrine DBAL if maintenance is a concern. Start with non-critical transactions to validate stability.
- Can I use this for multi-database transactions (e.g., PostgreSQL + MySQL)?
- Yes, the package is designed for dialect-agnostic transactions, making it suitable for multi-database setups. However, ensure both databases support the transaction features you need (e.g., isolation levels, nested transactions). Test thoroughly, as some SQL dialects may behave differently in edge cases.