carsdotcom / laravel-json-model
Laravel models backed by JSON data
Installs: 11 202
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 19
Forks: 1
Open Issues: 5
Requires
- php: ^8.1
- ext-json: *
- carsdotcom/laravel-json-schema: ^v1.0.1 || ^v2 || ^2.1
- laravel/framework: ^9.19 || ^10.0 || ^11.0
Requires (Dev)
- fakerphp/faker: ^1.9.1
- mockery/mockery: ^1.4.4
- nunomaduro/collision: ^6.1|7.*|8.*
- orchestra/testbench: 7.*|8.*|9.*
- phpstan/phpstan: ^1.8
- phpunit/phpunit: ~8.0|~9.0|^10.5
- squizlabs/php_codesniffer: ^3.7
This package is auto-updated.
Last update: 2024-12-04 16:18:26 UTC
README
We really love Laravel as an ORM. But we have a part of our application that persists to a document store, not a relational database. Json Models let us use the best parts of the Eloquent Models, but instead of being backed by a row in a table, they're always serialized to JSON. (Which can include being serialized to an attribute on a traditional Laravel Model!)
Setup
For now, you will need to add the following for events to work properly.
- In AppServiceProvider boot method:
JsonModel::setEventDispatcher($this->app['events']);
- In AppServiceProvider register method:
JsonModel::clearBootedModels();