PHPackages                             soysaltan/marygen - 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. [Templating &amp; Views](/categories/templating)
4. /
5. soysaltan/marygen

ActiveLibrary[Templating &amp; Views](/categories/templating)

soysaltan/marygen
=================

Generate MaryUI based pages with one line command

0.36.2(1y ago)28122MITPHP

Since Sep 8Pushed 1y ago2 watchersCompare

[ Source](https://github.com/paramientos/marygen)[ Packagist](https://packagist.org/packages/soysaltan/marygen)[ Docs](https://marygen.expozy.co)[ RSS](/packages/soysaltan-marygen/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (12)Used By (0)

MaryGen Documentation
=====================

[](#marygen-documentation)

Table of Contents
-----------------

[](#table-of-contents)

1. [Introduction](#introduction)
2. [Features](#features)
3. [Requirements](#requirements)
4. [Installation](#installation)
5. [Configuration](#configuration)
6. [Usage](#usage)
7. [Command Structure](#command-structure)
8. [Generated Components](#generated-components)
9. [Customization](#customization)
10. [Translation Feature](#translation-feature)
11. [Troubleshooting](#troubleshooting)
12. [Contributing](#contributing)
13. [License](#license)
14. [Support](#support)

Introduction
------------

[](#introduction)

MaryGen is a powerful Laravel package designed to streamline the process of generating MaryUI components and Livewire pages for your Laravel models. It automates the creation of CRUD (Create, Read, Update, Delete) interfaces, saving developers significant time and effort in setting up admin panels or data management systems.

Features
--------

[](#features)

- Automatic generation of MaryUI components for Laravel models
- Creation of Livewire pages with full CRUD functionality
- Intelligent form field generation based on database schema
- Automatic table column generation
- Built-in sorting, pagination, and search capabilities
- Easy customization options
- Automatic route generation
- Translation support for generated content (new in version 0.35.0)

Requirements
------------

[](#requirements)

- Laravel 10.x or higher
- PHP 8.0 or higher
- [MaryUI](https://github.com/robsontenorio/mary) package
- [Livewire Volt](https://livewire.laravel.com/docs/volt) package

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

[](#installation)

1. Ensure you have a Laravel project set up.
2. Install the MaryUI:

3. Install the Livewire, Livewire Volt packages (if not already installed with MaryUI):

    ```
    composer require livewire/livewire livewire/volt && php artisan volt:install
    ```
4. Install the MaryGen package:

    ```
    composer require soysaltan/marygen
    ```
5. (Optional) Publish the configuration file:

    ```
    php artisan vendor:publish --provider="SoysalTan\MaryGen\MaryGenServiceProvider" --tag="config"
    ```

Configuration
-------------

[](#configuration)

After publishing the configuration file, you can modify `config/marygen.php` to customize the package behavior:

```
return [
    'model_namespace' => 'App\Models',
    'use_mg_like_eloquent_directive' => true,
];
```

- `model_namespace`: Define the namespace for your models. Default is `App\Models`.
- `use_mg_like_eloquent_directive`: Determine whether to use the MgLike Eloquent directive for search functionality. For example:

```
$q->mgLike(['id', 'username', 'email', 'password', 'name', 'lastname', 'title', 'phone', 'avatar', 'time_zone', 'last_login_at', 'status', 'created_at', 'updated_at'], $this->search))
```

Usage
-----

[](#usage)

To generate a MaryUI component and Livewire page for a model, use the following command:

```
php artisan marygen:make {--m|model=} {--w|view=} {--d|dest_lang=} {--s|source_lang=} {--nr|no-route}
```

- `--m|model`: The name of the model for which you want to generate the components.
- `--w|view`: (Optional) The name of the view file. If not provided, it will use the lowercase model name.
- `--d|dest_lang`: (Required if source\_lang presents) The destination language code for translation.
- `--s|source_lang`: (Optional) The source language code for translation.If not present, it detects the source language automatically.
- `--nr|no-route`: (Optional - as of `v0.35.2`) Prevent automatic route addition to routes/web.php.

Example:

```
php artisan marygen:make --model=User --view=admin-users --dest_lang=es --no-route
```

This command will generate a Livewire page for the User model with CRUD functionality, name the view file `admin-users.blade.php`, and translate the content from English to Spanish and skip the automatic route generation.

Prevent Automatic Route Generation (as of `v0.35.2`)
----------------------------------------------------

[](#prevent-automatic-route-generation-as-of-v0352)

Starting from version `0.35.2`, MaryGen prevents automatic route generation feature. By default, when you generate a new component without using --no-route option with the `marygen:make` command, a corresponding route is automatically added to your `routes/web.php` file.

New in Version 0.36.1: Multi-Database Connection Support
--------------------------------------------------------

[](#new-in-version-0361-multi-database-connection-support)

As of version 0.36.1, MaryGen now supports models that use different database connections. This feature allows you to generate components and pages for models that are associated with databases other than your default connection.

### How it works

[](#how-it-works)

MaryGen now respects the `$connection` property of your Eloquent models. When generating components and pages, it will use the specified connection to:

1. Retrieve the correct table schema
2. Generate appropriate form fields
3. Create table columns
4. Set up sorting and filtering

### Usage

[](#usage-1)

No additional configuration is required. Simply ensure that your model specifies the correct connection:

```
class User extends Model
{
    protected $connection = 'secondary_db';

    // ... rest of your model
}
```

When you run the `marygen:make` command for this model, MaryGen will automatically use the 'secondary\_db' connection for all database operations.

### Example

[](#example)

```
php artisan marygen:make --model=User
```

If the User model specifies a different connection, MaryGen will use that connection to generate the component and page.

### Notes

[](#notes)

- Ensure that all specified connections are properly configured in your `config/database.php` file.
- If a model doesn't specify a connection, MaryGen will use the default database connection.
- This feature is particularly useful for applications that interact with multiple databases or use database sharding.

Customization
-------------

[](#customization)

You can customize the generated components by modifying the following methods in the `MaryGenCommand` class:

- `getMaryUIComponent()`: Adjust the mapping between database column types and MaryUI components.
- `getIconForColumn()`: Modify the icon selection for form fields.
- `generateLivewirePage()`: Customize the structure of the generated Livewire component and Blade view.

Additionally, you can edit the generated files directly to further tailor them to your specific needs.

Translation Feature
-------------------

[](#translation-feature)

MaryGen includes a translation feature that allows you to generate content in different languages. This feature uses the Google Translate API to translate field names, labels, and other text elements in the generated components. It uses `stichoza/google-translate-php` package. () To use the translation feature:

1. Specify the destination language using the `--dest_lang` option when running the `marygen:make` command.
2. Optionally, specify the source language using the `--source_lang` option. If not provided, Google Translate will attempt to auto-detect the source language.

Example:

```
php artisan marygen:make --model=Product --view=product-management --dest_lang=fr --source_lang=en
```

This command will generate the components for the Product model and translate the content from English to French.

Note: The translation feature requires an active internet connection to communicate with the Google Translate API.

Troubleshooting
---------------

[](#troubleshooting)

Common issues and their solutions:

1. **MaryUI package not found**:

    - Error: `MaryUI package not found! Please install using: 'composer req robsontenorio/mary'`
    - Solution: Run `composer require robsontenorio/mary` to install the MaryUI package.
2. **Livewire Volt package not found**:

    - Error: `Livewire Volt package not found! Please see doc: 'https://livewire.laravel.com/docs/volt#installation'`
    - Solution: Install Livewire Volt using `composer require livewire/livewire livewire/volt && php artisan volt:install`.
3. **Model not found**:

    - Error: `Model {modelName} does not exist!`
    - Solution: Ensure the specified model exists in your model namespace (default: `App\Models`).
4. **View file already exists**:

    - Error: `File {viewName}.blade.php already exists!`
    - Solution: Choose a different name for your view or manually delete the existing file if you want to overwrite it.
5. **Translation errors**:

    - Error: Various Google Translate API errors
    - Solution: Ensure you have an active internet connection and that the language codes you're using are valid. Check the Google Translate documentation for supported language codes.
6. **Route generation issues**:

    - Problem: Unwanted routes being added to routes/web.php
    - Solution: Use the --no-route option when running the marygen:make command to prevent automatic route generation.

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

[](#contributing)

Contributions to MaryGen are welcome! Here's how you can contribute:

1. Fork the repository
2. Create a new branch for your feature or bug fix
3. Write your code and tests
4. Submit a pull request with a clear description of your changes

Please ensure your code adheres to the existing style conventions and includes appropriate tests.

License
-------

[](#license)

MaryGen is open-source software licensed under the MIT license.

Support
-------

[](#support)

For more information or support:

- Open an issue on the [GitHub repository](https://github.com/soysaltan/mary-gen)
- Contact the package maintainer through the repository's contact information

---

For the latest updates and more detailed information about MaryUI, please visit the [official MaryUI documentation](https://mary-ui.com/docs/installation).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity36

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

Every ~4 days

Recently: every ~10 days

Total

11

Last Release

571d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f6d9a01a2e600f584111a562f8b3b51fe0e10b03d036c8f573fd45a53e44a947?d=identicon)[soysaltan](/maintainers/soysaltan)

---

Top Contributors

[![paramientos](https://avatars.githubusercontent.com/u/4548213?v=4)](https://github.com/paramientos "paramientos (37 commits)")

---

Tags

laraveluicomponentsbladelivewiretailwindalpinejslivewire componentslivewire-uitallstacktallstack componentsDaisyUIlivewire-packageslivewire ui componentstallstack uitallstackuiblade ui componentslivewire 3

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/soysaltan-marygen/health.svg)

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

###  Alternatives

[robsontenorio/mary

Gorgeous UI components for Livewire powered by daisyUI and Tailwind

1.5k454.7k15](/packages/robsontenorio-mary)[developermithu/tallcraftui

TallCraftUI is a Laravel blade UI components library built on TALL stack

1672.4k](/packages/developermithu-tallcraftui)[electrik/slate

Slate - a Laravel Blade UI Kit is a set of anonymous blade components built using TailwindCSS v4 with built-in dark mode support for your next Laravel project

102.3k1](/packages/electrik-slate)[ddfsn/blade-components

Blade Components is a hand-crafted, UI component library for building consistent web experiences in Laravel apps.

193.1k](/packages/ddfsn-blade-components)

PHPackages © 2026

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