PHPackages                             jinn/laravel - 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. [API Development](/categories/api)
4. /
5. jinn/laravel

ActiveLibrary[API Development](/categories/api)

jinn/laravel
============

Jinn for Laravel. Models, Migrations and API generator.

v0.2.1(4y ago)837MITPHPPHP &gt;=7.4

Since Dec 24Pushed 3y ago1 watchersCompare

[ Source](https://github.com/alex-shevchenko/jinn-laravel)[ Packagist](https://packagist.org/packages/jinn/laravel)[ Docs](https://jinncode.dev/)[ RSS](/packages/jinn-laravel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (6)Used By (0)

What is Jinn
============

[](#what-is-jinn)

Jinn is a code generator that speeds up your work by generating Models, Migrations, and APIs from simple YAML-based definitions. What makes Jinn different from other generators is that it lets you customize the generated code without losing the ability to update it when definitions change.

**Read full documentation at [jinncode.dev](https://jinncode.dev/).**

Key Concepts
============

[](#key-concepts)

Of course, there are plenty of frameworks and libraries which serve the same purposes using various approaches. This section describes key design decisions which make Jinn different.

Code generation
---------------

[](#code-generation)

Unlike many API and admin panel frameworks, Jinn uses code generation, as it gives the following benefits:

- Only the code that is needed is generated, i.e., if you don't need an `update` method in your API, it will not be generated at all.
- The generated code does not have to be very generic, which makes it much simpler.

Symfony and Laravel frameworks also use code generation. However, they apply caching approach, i.e., generate the code at runtime. Jinn generates the code at build-time, which means that there are no first-run performance drawbacks and lets you inspect the code easily.

All the above means that:

- Jinn carries no performance drawbacks compared to the other approaches.
- It is easy to inspect the code, understand how it works, extend and customize it.

Base classes
------------

[](#base-classes)

Each class generated by Jinn (except for Migrations) is split into two files:

1. An empty class under your sources folder which extends a
2. Base class, located in a separate folder which contains all the logic

The idea is borrowed from `Propel`, a well-known in the past PHP ORM. The main class is generated only once and never updated, so you can use it to customize generated logic freely. At the same Jinn can update the base class logic for you whenever the definition changes.

Database
--------

[](#database)

Currently, Jinn supports SQL databases only. MongoDB support is planned.

Jinn is designed to manage its database tables and models, i.e., it is not able to work with existing models and database tables. It also expects that no changes will be made to its database tables; otherwise, they may be overwritten. At the same time, it is possible to have Jinn-managed and non-Jinn-managed tables in the same database.

Frameworks
----------

[](#frameworks)

The Jinn reference implementation is made for Laravel, but it is designed to allow implementation for any framework. Contributors are welcome.

Further down this guide, the sections which are specific to Laravel will be marked correspondingly.

Installation
============

[](#installation)

Setup via composer
------------------

[](#setup-via-composer)

```
composer require jinn/jinn-laravel@dev-master
```

Publish Jinn config file
------------------------

[](#publish-jinn-config-file)

```
php artisan vendor:publish --provider="Jinn\Laravel\JinnServiceProvider"
```

Create Jinn folder structure
----------------------------

[](#create-jinn-folder-structure)

Default structure:

```
jinn
- def
- gen

```

An alternative structure can be configured via `config/jinn.php`. Further, this guide will use a default configuration. Changing the Jinn configuration should result in corresponding changes to the next steps.

Configure autoload
------------------

[](#configure-autoload)

Edit `composer.json`, locate autoload section, and add a line as follows:

```
"autoload": {
    "psr-4": {
        ...
        "JinnGenerated\\": "jinn/gen/"
    }
}
```

Then ask the composer to update autoload files:

```
composer dump-autoload
```

Getting Started
===============

[](#getting-started)

Basic Definition
----------------

[](#basic-definition)

Copy the following definition into `jinn/def/entities.yaml` or create your own.

```
User:
  class:
    extends: Illuminate\Foundation\Auth\User
  properties:
    name: string
    email: { type: string, unique: true }
    password: string
    avatar_filename: { type: string, required: false }

Post:
  properties:
    content: text
    author: { entity: User, relation: many-to-one }
    published_at: datetime
    comments: { entity: Comment, relation: one-to-many }

Comment:
  properties:
    content: text
    author: { entity: User, relation: many-to-one }
    published_at: datetime
```

Generation
----------

[](#generation)

Ask Jinn to generate the files

```
php artisan jinn
```

Inspect generated files under `app` and `jinn/gen` folders.

TODO
====

[](#todo)

- Models:
    - More field types?
    - Different types for `id`
    - Allow making a required (non-nullable) many-to-one relation
- APIs:
    - Related controller
    - Additional methods: associated/disassociate, other?
    - Specs
- Migrations:
    - MongoDB
- Admin panel
- File watcher
- Symfony implementation

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 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 ~16 days

Total

4

Last Release

1522d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1a6598f21c3332e075b60f8f3bf7680082a994d549342fea6779143fdf2109e4?d=identicon)[alex-shevchenko](/maintainers/alex-shevchenko)

---

Top Contributors

[![alex-shevchenko](https://avatars.githubusercontent.com/u/2803555?v=4)](https://github.com/alex-shevchenko "alex-shevchenko (3 commits)")

---

Tags

generatorjinn

### Embed Badge

![Health badge](/badges/jinn-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/jinn-laravel/health.svg)](https://phpackages.com/packages/jinn-laravel)
```

###  Alternatives

[apigen/apigen

PHP source code API generator.

2.2k627.9k225](/packages/apigen-apigen)[infyomlabs/swagger-generator

Swagger Generator for InfyOm Laravel Generator

1151.1M5](/packages/infyomlabs-swagger-generator)[crada/php-apidoc

Generate documentation for php API based application. No dependency. No framework required.

259206.9k2](/packages/crada-php-apidoc)[code-lts/doctum

Doctum, a PHP API documentation generator. Fork of Sami

35077.9k31](/packages/code-lts-doctum)[gmostafa/php-graphql-oqm

GraphQL Object-to-Query Mapper (QOM) which generates objects from API schema

44898.8k2](/packages/gmostafa-php-graphql-oqm)[overblog/graphql-php-generator

GraphQL types generator

29518.9k](/packages/overblog-graphql-php-generator)

PHPackages © 2026

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