PHPackages                             mhasankn/dart-models - 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. mhasankn/dart-models

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

mhasankn/dart-models
====================

Laravel library to easily generate models for Dart/Flutter from command line.

v1.0.0(1y ago)3135MITPHP

Since Oct 24Pushed 1y ago1 watchersCompare

[ Source](https://github.com/MHasanKN/laravel-dart-models)[ Packagist](https://packagist.org/packages/mhasankn/dart-models)[ RSS](/packages/mhasankn-dart-models/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Laravel Dart Models
===================

[](#laravel-dart-models)

This package allows you to generate Dart/Flutter models directly from Laravel migrations or database schema. It simplifies the creation of strongly-typed Dart models by parsing your Laravel structure and generating code accordingly.

Features
--------

[](#features)

- Generate models from Laravel **migrations**.
- Generate models from your **database schema**.
- Supports nullable fields and various Laravel column types.
- Provides JSON serialization methods for Dart models.

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

[](#installation)

1. Add this package to your Laravel project via Composer:

```
composer require mhasankn/dart-models
```

2. In your Laravel project, open config/app.php or bootstrap/providers.php and add the following entry to the providers array:

```
'providers' => [
    // Other service providers...
    Mhasankn\DartModels\DartModelsServiceProvider::class,
],

```

Usage
-----

[](#usage)

1. Generate models from migrations: bash Copy code php artisan dart:models --from-migrations This command will parse all migration files in your Laravel project and generate Dart models based on the table structure.
2. Generate models from the database schema: bash Copy code php artisan dart:models --from-database This command connects to your Laravel database and generates Dart models based on the existing table schema.

Example Dart Model
------------------

[](#example-dart-model)

Below is an example of a Dart model generated by the package:

```
class User {
  final String name;
  final String email;
  final DateTime? createdAt;

  User({required this.name, required this.email, this.createdAt});

  factory User.fromJson(Map json) => User(
    name: json['name'] as String,
    email: json['email'] as String,
    createdAt: json['createdAt'] != null
        ? DateTime.parse(json['createdAt'])
        : null,
  );

  Map toJson() => {
    'name': name,
    'email': email,
    'createdAt': createdAt?.toIso8601String(),
  };
}

```

This formatting ensures clarity and consistency for the users of your package. Let me know if further adjustments are needed!

Contributing
------------

[](#contributing)

Feel free to open issues or submit PRs. Contributions are welcome!

License
-------

[](#license)

This package is licensed under the MIT License. See [LICENSE.md](LICENSE.md) for details.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

563d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/74527ec076fb2691d03268b0a54ca9487cb5a42ba84c3b2eccdbab49ce165359?d=identicon)[MHasanKn](/maintainers/MHasanKn)

---

Top Contributors

[![MHasanKN](https://avatars.githubusercontent.com/u/106889523?v=4)](https://github.com/MHasanKN "MHasanKN (3 commits)")

---

Tags

cli-toolsdartdatabase-modelsflutterlaravellaravel-migrationslaravel-packagemigrationmigration-toolsmodels-generationphp

### Embed Badge

![Health badge](/badges/mhasankn-dart-models/health.svg)

```
[![Health](https://phpackages.com/badges/mhasankn-dart-models/health.svg)](https://phpackages.com/packages/mhasankn-dart-models)
```

###  Alternatives

[tightenco/ziggy

Use your Laravel named routes in JavaScript.

4.3k41.6M267](/packages/tightenco-ziggy)[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)[nickurt/laravel-akismet

Akismet for Laravel 11.x/12.x/13.x

97139.6k2](/packages/nickurt-laravel-akismet)[sbine/route-viewer

A Laravel Nova tool to view your registered routes.

57215.9k](/packages/sbine-route-viewer)

PHPackages © 2026

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