Lean Mapper — lightweight & powerfull ORM
Do you looking for lightweight ORM for your PHP apps? Try Lean Mapper!
Lean Mapper is tiny ORM for PHP. It’s based on Dibi — Database Abstraction Layer.
Get DevStory’s stories in your inbox
Join Medium for free to get updates from this writer.
Lean Mapper is inspired by “NotORM principle” and generates effective SQL queries, has minimal dependencies (only Dibi), is stable and simple to use.
Installation
composer require tharos/leanmapperUsage
Database schema
book
- id
- author_id
- name
- availableauthor
- id
- nametag
- id
- namebook_tag
- book_id
- tag_id
Entities
Base element of Lean Mapper is entity. Entity represents object of real world — for example Student, Teacher, Book, Author, etc.
Repositories
For loading, creating, updating and deleting of entities we need repositories. Repository can be very simple.
Example
Simple, isn’t it?
What next?
You can try Quick Start, follow Lean Mapper on Twitter, ask on forum or check out examples and repository on GitHub.






