Download the PHP package rajentrivedi/transaction-x without Composer
On this page you can find all versions of the php package rajentrivedi/transaction-x. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rajentrivedi/transaction-x
More information about rajentrivedi/transaction-x
Files in rajentrivedi/transaction-x
Package transaction-x
Short Description implements database transaction with ease
License MIT
Homepage https://github.com/rajen-trivedi/transaction-x
Informations about the package transaction-x
TransactionX - Laravel Transaction Package
TransactionX is a powerful Laravel package designed to simplify database transactions within your application. This package provides a seamless way to handle database transactions for specific routes, ensuring data integrity and consistency.
Features
-
Automatic Transactions: TransactionX automatically manages database transactions for routes where it is applied. It starts a transaction before the route is executed and commits or rolls back the transaction based on the route's outcome.
-
Conditional Execution: The package executes transactions only for non-GET requests, minimizing the impact on read-only operations and optimizing the database interactions for data-altering requests.
- Error Handling: TransactionX intelligently handles exceptions and errors during the route execution. If an exception occurs or if there are errors reported by Laravel's error handling system, the middleware rolls back the transaction to maintain a consistent state.
Getting Started
Installation:
Install the TransactionX package using Composer.
Setup:
Apply the TransactionMiddleware to the route group where you want to enable automatic transactions.
Or, you can apply the TransactionMiddleware to specific route.
Before Applying TransactionX
In this example, there are operations involving two different tables (User and UserProfile). Manually handling transactions in this scenario can lead to increased complexity and a higher chance of errors.
After Applying TransactionX
With TransactionX, the middleware takes care of the transaction handling, even when there are multiple database interactions within the same route. This leads to cleaner and more readable code, as the developer can focus on the logic of the route without the need to manage transactions explicitly. The middleware ensures that the transactions are handled consistently across different tables, promoting code cleanliness and maintainability.
Enjoy Consistent Transactions
With TransactionX, focus on building your application logic, while the package ensures that your database transactions are handled consistently.
Contribution
If you encounter issues or have suggestions for improvements, feel free to open an issue or submit a pull request on the GitHub repository.
License
TransactionX is open-source software licensed under the MIT License.
All versions of transaction-x with dependencies
spatie/laravel-package-tools Version ^1.14.0
illuminate/contracts Version ^10.0