Skip to content

ChaosWebDev/LaravelMongoModels

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Mongo Models

Latest Version on Packagist Total Downloads GitHub Stars GitHub License

A lightweight Laravel package that adds an Artisan command for generating MongoDB Eloquent models...


🚀 Installation

You can install the package via Composer:

composer require chaoswd/laravel-mongo-models

Tested on Laravel 12.x.
Likely compatible with Laravel 10 and 11, but unverified. Requires the mongodb/laravel driver installed.


⚙️ Usage

Generate a MongoDB model using the custom Artisan command:

php artisan make:mongo:model {name} --collection="collectionName"

Example

php artisan make:mongo:model User --collection="users"

This command will create a model at:

app/Models/User.php

with the following structure:

<?php

namespace App\Models;

use MongoDB\Laravel\Eloquent\Model;

class User extends Model
{
    protected $connection = 'mongodb';
    protected $collection = 'users';

    protected $guarded = [];
}

🧩 Features

  • 🔹 Generates MongoDB-compatible Eloquent models
  • 🔹 Uses the official mongodb/laravel driver
  • 🔹 Automatically sets connection and collection properties
  • 🔹 Simple, framework-native syntax

🧰 Requirements


🧾 License

This package is open-sourced software licensed under the MIT License.
© Jordan Gerber DBA Chaos Web Development


🕒 Changelog

See the CHANGELOG.md for version history and release notes.


💬 Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss your ideas.
Please make sure to update tests as appropriate.


Created with 🌀 by Chaos Web Development

About

A lightweight Laravel package that adds an Artisan command for generating MongoDB Eloquent models.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages