Installation

The package can be installed using composer using the command bellow:

composer require jerodev/data-mapper

Requirements

  • PHP8.1 or higher

The package does not depend on any other packages to operate so implementing and upgrading can be as seamless as possible.

Clearing the cache

The mapper caches custom mappers for classes indefinitly.
Because of this, it is recommended to add the followin script to your composer.json file to clear these caches when installing, updating or deploying your codebase.

"scripts": {
    "post-autoload-dump": [
        "Jerodev\\DataMapper\\MapperCommands::clearCache"
    ]
}

The cache for a class is based on its namespaced name. So if you don't clear the cache and the class definition changes, the mapper will probably fail.