PHPackages                             saher/artisan-schematics - 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. saher/artisan-schematics

ActiveLaravel-package[Utility &amp; Helpers](/categories/utility)

saher/artisan-schematics
========================

Generate model definitions for any language (TypeScript, Dart, Kotlin, etc.) directly from your Laravel backend.

v1.3.0(9mo ago)01MITPHPPHP ^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4CI passing

Since Aug 10Pushed 9mo agoCompare

[ Source](https://github.com/Qaidsaher/artisan-schematics)[ Packagist](https://packagist.org/packages/saher/artisan-schematics)[ RSS](/packages/saher-artisan-schematics/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (6)Used By (0)

Artisan Schematics
==================

[](#artisan-schematics)

[![Tests](https://camo.githubusercontent.com/d940ad7f0752e2cbe0d63c50dcebf329078807390051c41fe63258f1b5c4e182/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74657374732d70617373696e672d627269676874677265656e)](./vendor/bin/pest)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE.md)[![Packagist](https://camo.githubusercontent.com/db0015c872769301c80d035572c025eec6e23604032b092a3be968bd85a38528/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73616865722f6172746973616e2d736368656d6174696373)](https://packagist.org/packages/saher/artisan-schematics)[![GitHub Repo](https://camo.githubusercontent.com/de7b58312272928c0d04cc4ed76166a3f54688939c0c15dbf4cee590a331c3e9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6769746875622d7265706f2d626c75653f6c6f676f3d676974687562)](https://github.com/Qaidsaher/artisan-schematics)

**Artisan Schematics** is the most powerful, extensible, and professional Laravel package for exporting your Eloquent models and PHP enums to TypeScript, Dart, Kotlin, and Swift. It is designed for teams and individuals who want seamless, type-safe, cross-platform development.

---

🚀 Features
----------

[](#-features)

- **Multi-language output:** TypeScript, Dart, Kotlin, Swift (easily add more)
- **Deep relationship support:** Handles all Eloquent relationships (hasOne, hasMany, belongsTo, belongsToMany, morphTo, morphMany, hasOneThrough, etc.)
- **Enum and custom cast detection**
- **Recursive dependency resolution** (all referenced models/enums are included)
- **Configurable output paths and language toggles**
- **Zero manual require/include: full autoloading**
- **Battle-tested:** Comprehensive test suite for all features
- **Extensible:** Add your own generators in minutes
- **Professional code output:** Idiomatic, readable, and ready for production

---

📦 Installation
--------------

[](#-installation)

```
composer require saher/artisan-schematics --dev
```

---

⚙️ Configuration
----------------

[](#️-configuration)

Publish the config file:

```
php artisan vendor:publish --provider="Saher\ArtisanSchematics\ArtisanSchematicsServiceProvider"
```

Edit `config/schematics.php` to enable/disable languages and set output paths for each target.

---

🛠️ Usage
--------

[](#️-usage)

Export all models and enums:

```
php artisan schematics:export
```

Or specify custom paths:

```
php artisan schematics:export --paths=app/Models,app/Enums
```

---

📂 Output
--------

[](#-output)

- **TypeScript:** `resource/ts/schemas` (default)
- **Dart:** `tests/output/dart` (customizable)
- **Kotlin:** `tests/output/kotlin` (customizable)
- **Swift:** `tests/output/swift` (customizable)

---

🧠 What gets generated?
----------------------

[](#-what-gets-generated)

- All models, enums, and their relationships (including advanced: morphs, through, etc.)
- All referenced types recursively (no missing dependencies)
- Output files for each language (e.g., `Post.ts`, `PostStatus.dart`, `User.kt`, `Tag.swift`, etc.)

---

💡 Example
---------

[](#-example)

### Models

[](#models)

```
class User extends Model {
	public function posts() { return $this->hasMany(Post::class); }
	public function tags() { return $this->belongsToMany(Tag::class); }
	public function comments() { return $this->morphMany(Comment::class, 'commentable'); }
	public function country() { return $this->hasOneThrough(Country::class, Address::class); }
}

class Post extends Model {
	protected $casts = [
		'status' => PostStatus::class,
		'tags' => 'array',
	];
	public function author() { return $this->belongsTo(User::class); }
}

class Comment extends Model {
	public function post() { return $this->hasMany(Post::class); }
	public function tags() { return $this->belongsToMany(Tag::class); }
}

class Tag extends Model {}
class Country extends Model {}
class Address extends Model {}
```

### Enum

[](#enum)

```
enum PostStatus: string { case DRAFT = 'draft'; case PUBLISHED = 'published'; }
```

### Output

[](#output)

- `User.ts`, `Post.ts`, `Comment.ts`, `Tag.ts`, `Country.ts`, `Address.ts`, `PostStatus.ts`
- `user.dart`, `post.dart`, `comment.dart`, `tag.dart`, `country.dart`, `address.dart`, `post_status.dart`
- `User.kt`, `Post.kt`, `Comment.kt`, `Tag.kt`, `Country.kt`, `Address.kt`, `PostStatus.kt`
- `User.swift`, `Post.swift`, `Comment.swift`, `Tag.swift`, `Country.swift`, `Address.swift`, `PostStatus.swift`

---

🧪 Testing
---------

[](#-testing)

Run the test suite:

```
./vendor/bin/pest
```

Tests assert that all expected files are generated for all languages, including enums and all relationship types.

---

🧩 Extending
-----------

[](#-extending)

Add your own generator by implementing `GeneratorContract` and registering it in `config/schematics.php`:

```
'go' => [
	'enabled' => true,
	'generator' => \App\Generators\GoGenerator::class,
	'output_path' => base_path('go/models'),
],
```

---

🛠️ Advanced Usage &amp; Tips
----------------------------

[](#️-advanced-usage--tips)

- **Custom relationships:** All Eloquent relationship types are supported out of the box.
- **Enum support:** Backed and pure enums are both supported.
- **Custom casts:** Custom cast types are detected and exported.
- **Zero manual require/include:** All files are autoloaded and analyzed recursively.
- **CI/CD ready:** Add `./vendor/bin/pest` to your pipeline to ensure your contracts are always up to date.

---

❓ Troubleshooting
-----------------

[](#-troubleshooting)

- **Missing files?** Ensure your models/enums are in the scanned paths and autoloaded by Composer.
- **Custom output?** Edit `config/schematics.php` to change output directories or add new languages.
- **Need more?** Open an issue or PR!

---

🤝 Community &amp; Contributing
------------------------------

[](#-community--contributing)

Pull requests, issues, and feature requests are welcome! Help make Artisan Schematics the standard for cross-platform Laravel development.

---

📄 License
---------

[](#-license)

MIT

---

📦 Releases &amp; Tags
---------------------

[](#-releases--tags)

- [View latest release and all tags on GitHub](https://github.com/Qaidsaher/artisan-schematics/releases)
- [View on Packagist](https://packagist.org/packages/saher/artisan-schematics)

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance57

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity57

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

Total

5

Last Release

281d ago

PHP version history (2 changes)v1.0.0PHP ^8.1

v1.2.0PHP ^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/66569726e76d34b7bd66c045c53003da3a4d1d968b98e6199b4219bef5d03cde?d=identicon)[Qaidsaher](/maintainers/Qaidsaher)

---

Top Contributors

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

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/saher-artisan-schematics/health.svg)

```
[![Health](https://phpackages.com/badges/saher-artisan-schematics/health.svg)](https://phpackages.com/packages/saher-artisan-schematics)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[spatie/laravel-enum

Laravel Enum support

3655.4M31](/packages/spatie-laravel-enum)[laravel/pennant

A simple, lightweight library for managing feature flags.

57311.1M53](/packages/laravel-pennant)[wnx/laravel-stats

Get insights about your Laravel Project

1.8k1.8M7](/packages/wnx-laravel-stats)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)

PHPackages © 2026

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