Download the PHP package zain/laravel-doctrine-jetpack without Composer
On this page you can find all versions of the php package zain/laravel-doctrine-jetpack. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-doctrine-jetpack
Laravel Doctrine Jetpack
A set of productivity boosting helpers to make life with Laravel Doctrine simpler and faster.
Installation
This package strictly requires php >= 7.4
.
Require the package using Composer.
Laravel automatically discovers the package. No additional steps are necessary.
Usage
Generators
This package includes a few generators that allow you to speed up your workflow when it comes to writing entities and mapping classes using Laravel Doctrine.
Entity Generator
Generate a new Doctrine entity using the included stub by running the following artisan
command:
By default, this will create a new file in app/Entities
called MyEntity.php
, like so:
Fluent Mapping Generator
This package comes with a generator for Laravel Doctrine's Fluent mapping driver, a very Laravel-like way of writing your Doctrine mappings.
The included command takes a target entity as an argument and generates a mapping file.
By default, this will create a new file in app/Database/Doctrine/Mappings/
called MyEntityMapping.php
, like so:
Generate a Fluent Mapping class for a Value Object (Embeddable).
By default, this will create a new file in app/Database/Doctrine/Mappings/Values/
called MyValueMapping.php
.
FlushEntityManager Middleware
Simplify the process of actually persisting your entities to the database using the included middleware.
Add the middleware to your app/Http/Kernel.php
file like so:
Helpers
Entity Serialization
This package also includes a helper trait that allows you to make your entities (and potentially any other class) serializable to JSON or an array with just a single line.
Note: for the best experience with Laravel, I recommend having your Entity classes implement the three standard interfaces in the example above. This is not necessary but it will allow you to simply
return
your model from a controller, or inspect it intinker
. (I am not recommending doing the former, but it is definitely useful for debugging in a pinch.)
Customization & Configuration
This package allows you to easily customize almost every aspect of the generators. Get started by publishing the config file.
This will create a file in your config directory called jetpack.php
. Edit this file to change the default
namespace for your Entities, Value Objects, and Mapping classes.
For advanced customization, this package allow you to customize the built-in stub files to your own needs.
First, ensure you've already published the config file in the step above. Next, publish the stubs using the following command.
This will write the stub files to resources/jetpack/stubs
. Feel free to edit the files as you please, but keep the
placeholder names intact.
Finally, update config/jetpack.php
:
Development
All contributions are welcome. Found a bug? Open an issue in Github, or even better, submit a Pull Request.
Running Tests
Check out the project locally, and run: