Sitemap

Lean Mapper — lightweight & powerfull ORM

1 min readMay 2, 2018

--

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/leanmapper

Usage

Database schema

book
- id
- author_id
- name
- available
author
- id
- name
tag
- id
- name
book_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.

--

--

DevStory
DevStory

Written by DevStory

0 followers

About web development and programming.