Download the PHP package stwarog/fuel-fixtures without Composer
On this page you can find all versions of the php package stwarog/fuel-fixtures. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stwarog/fuel-fixtures
More information about stwarog/fuel-fixtures
Files in stwarog/fuel-fixtures
Package fuel-fixtures
Short Description Simple fixtures factory utils for Fuel/ORM package
License MIT
Informations about the package fuel-fixtures
Fixtures
This package is a simple util for generating commonly used data fixtures.
Basic usage
Documentation will be fulfilled. Consider the following Fixture example for Currency model:
Each of factory provides few very important methods (like Laravel`s one):
MakeOne/Many
- creates new instance.
CreateOne/Many
- creates new instance and persists using provided persistence strategy.
Sample call using with
:
Development
Standards
This package follows PSR-4 for autoloading and PSR-12 for styling.
Useful commands
The whole project is Unit tested and protected with strong static code analytics (phpstan).
Code is dockerized and simplified by makefile. Simply run:
If you can't run make file locally, then checkout the direct commands in composer.json.
Events
There is an abstraction of event dispatcher PSR-14 with NullObject implementation by default.
The intention is to add a capability to modify prepared model data in concrete situations, from the outside.
You can initialize concrete dispatcher by dependency and then access predefined events:
Name | Class | Description |
---|---|---|
model.before.prepared | BeforePrepared | Called right before any states (closures) has been applied. |
model.after.prepared | AfterPrepared | Called right after all states (closures) has been applied and before persistence event. |
model.before.persisted | BeforePersisted | Called right before prepared model is persisted in DB e.g. classes UowPersistence, FuelPersistence. |
model.after.persisted | AfterPersisted | Called right after prepared model is persisted in DB. |
Change Log
1.2.0 (2021-12-02) BREAKING CHANGE
- Refactor - added Config for Factory Dependency as amount of it grows up to quickly
- Added PSR container dependency
- Fixed Reference type (in getStates), to be aware of Container and avoid re-creating new instance if entry is present as DI
1.1.0 (2021-12-02)
- Added event dispatcher abstraction, and events: BeforePersisted, ModelPrepared
All versions of fuel-fixtures with dependencies
stwarog/uow-fuel Version ^2.0.0
psr/event-dispatcher Version ^1.0
psr/container Version ^2.0 || ^1.1.0
fakerphp/faker Version ^1.18