Download the PHP package bullet/doctrine-utils without Composer
On this page you can find all versions of the php package bullet/doctrine-utils. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bullet/doctrine-utils
More information about bullet/doctrine-utils
Files in bullet/doctrine-utils
Package doctrine-utils
Short Description This is my package doctrine-utils
License MIT
Homepage https://github.com/BulletDigitalSolutions/doctrine-utils
Informations about the package doctrine-utils
Doctrine Utils
Doctrine Utils is a package designed to enhance the functionality of Laravel applications by integrating advanced features for better route model bindings using Doctrine ORM.
Features
Route Model Bindings
This feature allows you to replace Laravel's default model binding with Doctrine's powerful ORM capabilities. By using Doctrine for model binding, you can take full advantage of Doctrine's features for retrieving entities.
Installation
To install the Route Model Bindings feature, follow these steps:
-
Replace Laravel Middleware: Replace the default Laravel "substitute bindings" middleware with the middleware provided by Doctrine Utils. Update your
Kernel.php
middleware configuration to use the following middleware: - Implement UrlRoutable Interface:
Add the
UrlRoutable
interface to your base entity and implement the required methods. This interface is necessary for the middleware to resolve route bindings using Doctrine's entity repository. Here is an example of how to implement it:
Usage
Once installed, the Doctrine Utils package will automatically handle route model bindings using Doctrine's entity repository. This allows you to define routes and controllers in Laravel as usual, while benefiting from the enhanced ORM capabilities provided by Doctrine.
Example
Here is an example of how it works:
-
Define Routes:
- Controller Methods:
Requirements
- Laravel 8.x or higher
- Doctrine ORM
License
Doctrine Utils is open-source software licensed under the MIT license. Feel free to contribute or modify the package to suit your needs.
Contributing
If you would like to contribute to Doctrine Utils, please fork the reposit