PHPackages                             inlm/schema-generator-leanmapper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. inlm/schema-generator-leanmapper

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

inlm/schema-generator-leanmapper
================================

Lean Mapper bridge for inlm/schema-generator

v1.1.0(10mo ago)1367BSD-3-ClausePHPPHP 8.0 - 8.4CI passing

Since Jul 28Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/inlm/schema-generator-leanmapper)[ Packagist](https://packagist.org/packages/inlm/schema-generator-leanmapper)[ Fund](https://www.janpecha.cz/donate/schema-generator/)[ RSS](/packages/inlm-schema-generator-leanmapper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

Schema Generator
================

[](#schema-generator)

[![Build Status](https://github.com/inlm/schema-generator-leanmapper/workflows/Build/badge.svg)](https://github.com/inlm/schema-generator-leanmapper/actions)[![Downloads this Month](https://camo.githubusercontent.com/a46d17c3163b165da94a26255614fca2839b20edd2d63df463aed3218c52f66e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f696e6c6d2f736368656d612d67656e657261746f722d6c65616e6d61707065722e737667)](https://packagist.org/packages/inlm/schema-generator-leanmapper)[![Latest Stable Version](https://camo.githubusercontent.com/af418c2d733fa2e6a92cf9d3da698d794ec5cd4257d2ae09de8d95fcfb36fe8e/68747470733a2f2f706f7365722e707567782e6f72672f696e6c6d2f736368656d612d67656e657261746f722d6c65616e6d61707065722f762f737461626c65)](https://github.com/inlm/schema-generator-leanmapper/releases)[![License](https://camo.githubusercontent.com/fa7d5fcf2c84b580327af52da95dd751703af65f079dc3c5a0081beac0789718/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4e65772532304253442d626c75652e737667)](https://github.com/inlm/schema-generator-leanmapper/blob/master/license.md)

[![Donate](https://camo.githubusercontent.com/101b981194f1dafbf9c42e19c3034fe2d724e75be972cef0f4477074997834db/68747470733a2f2f6275796d65636f666665652e696e746d2e6f72672f696d672f646f6e6174652d62616e6e65722e76312e737667)](https://www.janpecha.cz/donate/schema-generator/)

Installation
------------

[](#installation)

[Download a latest package](https://github.com/inlm/schema-generator-leanmapper/releases) or use [Composer](http://getcomposer.org/):

```
composer require inlm/schema-generator-leanmapper

```

Schema Generator requires PHP 8.0 or later.

Usage
-----

[](#usage)

```
$extractor = new Inlm\SchemaGenerator\LeanMapperBridge\LeanMapperExtractor(__DIR__ . '/model/Entities/', new LeanMapper\DefaultMapper);
$adapter = new Inlm\SchemaGenerator\Adapters\NeonAdapter(__DIR__ . '/.schema.neon');
$dumper = new Inlm\SchemaGenerator\Dumpers\SqlDumper(__DIR__ . '/migrations/structures/');
$logger = new Inlm\SchemaGenerator\Loggers\MemoryLogger;

$generator = new Inlm\SchemaGenerator\SchemaGenerator($extractor, $adapter, $dumper, $logger, Inlm\SchemaGenerator\Database::MYSQL);
// $generator->setTestMode();

$generator->generate();
// or
$generator->generate('changes description');
```

Documentation
-------------

[](#documentation)

`LeanMapperExtractor` generates schema from [Lean Mapper](http://leanmapper.com/) entities.

```
$directories = '/path/to/model/Entities/';
// or
$directories = [
	'/path/to/model/Entities/',
	'/path/to/package/Entities/',
];

$mapper = new LeanMapper\DefaultMapper;
$extractor = new Inlm\SchemaGenerator\LeanMapperBridge\LeanMapperExtractor($directories, $mapper);
```

Flags
-----

[](#flags)

```
@property string|NULL $web m:schemaType(varchar:50)

```

FlagDescriptionExample`m:schemaType`column datatype`m:schemaType(varchar:50)`, `m:schemaType(int:10 unsigned)``m:schemaComment`column comment`m:schemaComment(Lorem ipsum)``m:schemaAutoIncrement`has column AUTO\_INCREMENT?`m:schemaAutoIncrement``m:schemaIndex`create INDEX for column`m:schemaIndex``m:schemaPrimary`create PRIMARY KEY for column`m:schemaPrimary``m:schemaUnique`create UNIQUE INDEX for column`m:schemaUnique``m:schemaIgnore`ignore property`m:schemaUnique`If primary column is `integer` (`@property int $id`), automatically gets `AUTO_INCREMENT`.

Flag `m:schemaType` can be used with [custom types](https://github.com/inlm/schema-generator/blob/master/docs/custom-types.md) too - for example `m:schemaType(money)` or `m:schemaType(money unsigned)`.

In case if is flag `m:schemaType` missing, it uses [default type](https://github.com/inlm/schema-generator/blob/master/docs/default-types.md) or your [custom type](https://github.com/inlm/schema-generator/blob/master/docs/custom-types.md).

Annotations
-----------

[](#annotations)

AnnotationDescriptionExample`@schemaComment`table comment`@schemaComment Lorem ipsum``@schemaOption`table option`@schemaOption COLLATE utf8_czech_ci``@schemaIndex`create INDEX`@schemaIndex propertyA, propertyB``@schemaPrimary`create PRIMARY KEY`@schemaPrimary propertyA, propertyB``@schemaUnique`create UNIQUE INDEX`@schemaUnique propertyA, propertyB``@schemaIgnore`ignore entity`@schemaIgnore`You can define default [table options](https://github.com/inlm/schema-generator/blob/master/docs/table-options.md) globally.

Example
-------

[](#example)

```
/**
 * @property int $id
 * @property string $name m:schemaType(varchar:100)
 * @schemaOption COLLATE utf8_czech_ci
 */
class Author extends \LeanMapper\Entity
{
}
```

---

License: [New BSD License](license.md)
Author: Jan Pecha,

###  Health Score

38

—

LowBetter than 84% of packages

Maintenance57

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~703 days

Total

2

Last Release

312d ago

PHP version history (2 changes)v1.0.0PHP &gt;=5.6.0

v1.1.0PHP 8.0 - 8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/5c980b1511b4a0350442dc23d89c99d4d9a2411b7e765d52c133ccacf616968b?d=identicon)[janpecha](/maintainers/janpecha)

---

Top Contributors

[![janpecha](https://avatars.githubusercontent.com/u/637719?v=4)](https://github.com/janpecha "janpecha (12 commits)")

### Embed Badge

![Health badge](/badges/inlm-schema-generator-leanmapper/health.svg)

```
[![Health](https://phpackages.com/badges/inlm-schema-generator-leanmapper/health.svg)](https://phpackages.com/packages/inlm-schema-generator-leanmapper)
```

###  Alternatives

[t3docs/examples

This extension packages a number of code examples from the Core Documentation.

3120.2k](/packages/t3docs-examples)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
