{"id":21713552,"url":"https://github.com/xuanhoa88/laravel-modules","last_synced_at":"2026-04-14T17:31:29.316Z","repository":{"id":62518255,"uuid":"92939573","full_name":"xuanhoa88/laravel-modules","owner":"xuanhoa88","description":"llama-laravel/modules is a laravel package which created to manage your large laravel app using modules","archived":false,"fork":false,"pushed_at":"2017-07-12T08:28:26.000Z","size":63,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-16T06:02:35.958Z","etag":null,"topics":["framework","laravel","llama","modules"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xuanhoa88.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-31T11:31:23.000Z","updated_at":"2017-06-01T02:18:24.000Z","dependencies_parsed_at":"2022-11-02T13:30:47.571Z","dependency_job_id":null,"html_url":"https://github.com/xuanhoa88/laravel-modules","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/xuanhoa88/laravel-modules","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuanhoa88%2Flaravel-modules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuanhoa88%2Flaravel-modules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuanhoa88%2Flaravel-modules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuanhoa88%2Flaravel-modules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xuanhoa88","download_url":"https://codeload.github.com/xuanhoa88/laravel-modules/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuanhoa88%2Flaravel-modules/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31808505,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T11:13:53.975Z","status":"ssl_error","status_checked_at":"2026-04-14T11:13:53.299Z","response_time":153,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["framework","laravel","llama","modules"],"created_at":"2024-11-26T00:17:52.959Z","updated_at":"2026-04-14T17:31:29.298Z","avatar_url":"https://github.com/xuanhoa88.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel-Modules\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/llama-laravel/modules.svg?style=flat-square)](https://packagist.org/packages/llama-laravel/modules)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Build Status](https://img.shields.io/travis/llama-laravel/modules/master.svg?style=flat-square)](https://travis-ci.org/llama-laravel/modules)\n[![Scrutinizer Coverage](https://img.shields.io/scrutinizer/coverage/g/llama-laravel/modules.svg?maxAge=86400\u0026style=flat-square)](https://scrutinizer-ci.com/g/llama-laravel/modules/?branch=master)\n[![SensioLabsInsight](https://img.shields.io/sensiolabs/i/25320a08-8af4-475e-a23e-3321f55bf8d2.svg?style=flat-square)](https://insight.sensiolabs.com/projects/25320a08-8af4-475e-a23e-3321f55bf8d2)\n[![Quality Score](https://img.shields.io/scrutinizer/g/llama-laravel/modules.svg?style=flat-square)](https://scrutinizer-ci.com/g/llama-laravel/modules)\n[![Total Downloads](https://img.shields.io/packagist/dt/llama-laravel/modules.svg?style=flat-square)](https://packagist.org/packages/llama-laravel/modules)\n\n\n- [Upgrade Guide](#upgrade-guide)\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [Creating Module](#creating-a-module)\n- [Artisan Commands](#artisan-commands)\n- [Facades](#facades)\n- [Entity](#entity)\n- [Auto Scan Vendor Directory](#auto-scan-vendor-directory)\n- [Publishing Modules](#publishing-modules)\n\n`llama-laravel/modules` is a laravel package which created to manage your large laravel app using modules. Module is like a laravel package, it has some views, controllers or models. \n\nThis package is supported and tested in Laravel 5.\n\nThis package was inspired by [nwidart/laravel-modules](https://github.com/nWidart/laravel-modules).\n\n## Upgrade Guide\n\n## Installation\n\n### Quick\n\nTo install through composer, simply run the following command:\n\n``` bash\ncomposer require llama-laravel/modules\n```\n\n#### Add Service Provider\n\nNext add the following service provider in `config/app.php`.\n\n```php\n'providers' =\u003e [\n  Llama\\Modules\\ModuleServiceProvider::class,\n],\n```\n\nNext, add the following aliases to `aliases` array in the same file.\n\n```php\n'aliases' =\u003e [\n  'Module' =\u003e Llama\\Modules\\Facades\\Module::class,\n],\n```\n\nNext publish the package's configuration file by running:\n\n```\nphp artisan vendor:publish --provider=\"Llama\\Modules\\ModuleServiceProvider\"\n```\n\n#### Autoloading\n\nBy default controllers, entities or repositories are not loaded automatically. You can autoload your modules using `psr-4`. For example:\n\n```json\n{\n  \"autoload\": {\n    \"psr-4\": {\n      \"App\\\\\": \"app/\"\n    }\n  }\n}\n```\n\nAfter that, you must run statement below for dumps the autoloader:\n\n```shell\ncomposer dump-autoload -o\n```\n\n## Configuration\n\n- `modules` - Used for save the generated modules.\n- `assets` - Used for save the modules's assets from each modules.\n- `migration` - Used for save the modules's migrations if you publish the modules's migrations.\n- `seed` - Used for save the modules's seeds if you publish the modules's seeds.\n- `generator` - Used for generate modules folders.\n- `scan` - Used for allow to scan other folders.\n- `enabled` - If `true`, the package will scan other paths. By default the value is `false`\n- `paths` - The list of path which can scanned automatically by the package.\n- `composer`\n- `vendor` - Composer vendor name.\n- `author.name` - Composer author name.\n- `author.email` - Composer author email.\n- `cache`\n- `enabled` - If `true`, the scanned modules (all modules) will cached automatically. By default the value is `false`\n- `key` - The name of cache.\n- `lifetime` - Lifetime of cache.\n\n## Creating A Module\n\n**To create a new module, you can simply run:**\n\n```\nphp artisan module:make \u003cmodule-name\u003e\n```\n\n- `\u003cmodule-name\u003e` - Required. The name of module will be created.\n\nBy default if you create a new module, that will add some resources like controller, seed class or provider automatically. If you don't want these, you can add `--plain` flag, to generate a plain module.\n\n```shell\nphp artisan module:make \u003cmodule-name\u003e --plain\n#OR\nphp artisan module:make \u003cmodule-name\u003e -p\n```\n\n**Naming Convention**\n\nBecause we are autoloading the modules using `psr-4`, we strongly recommend using `StudlyCase` convension.\n\n**Folder Structure**\n\n```\nyour-laravel/app/Modules/\n  ├── Blog/\n      ├── Config/\n      ├── Database/\n          ├── Seeds/\n      ├── Http/\n          ├── Controllers/\n      ├── Providers/\n      ├── Resources/\n          ├── assets/\n          ├── lang/\n          ├── views/\n      ├── Routes/\n          ├── web.php\n          ├── api.php\n      ├── composer.json\n      ├── module.json\n```\n\n## Artisan Commands\n\nYou must be setting up modules folder for first use\n\n```\nphp artisan module:setup\n```\n\nCreate new module.\n\n```\nphp artisan module:make blog\n```\n\nUse the specified module.\n\n```\nphp artisan module:use blog\n```\n\nShow all modules in command line.\n\n```\nphp artisan module:list\n```\n\nCreate new command for the specified module.\n\n```\nphp artisan module:make-command CustomCommand blog\n#OR\nphp artisan module:make-command CustomCommand --command=custom:command blog\n```\n\nCreate new migration for the specified module.\n\n```\nphp artisan module:make-migration create_users_table blog\n#OR\nphp artisan module:make-migration create_users_table blog --create=users\n#OR\nphp artisan module:make-migration add_email_to_users_table blog --table=users\n```\n\nRollback, Reset and Refresh The Modules Migrations.\n\n```\nphp artisan module:migrate-rollback\n#OR\nphp artisan module:migrate-reset\n#OR\nphp artisan module:migrate-refresh\n```\n\nRollback, Reset and Refresh The Migrations for the specified module.\n\n```\nphp artisan module:migrate-rollback blog\n#OR\nphp artisan module:migrate-reset blog\n#OR\nphp artisan module:migrate-refresh blog\n```\n\nMigrate from the specified module.\n\n```\nphp artisan module:migrate blog\n```\n\nMigrate from all modules.\n\n```\nphp artisan module:migrate\n```\n\nCreate new seeder for the specified module.\n\n```\nphp artisan module:make-seeder PostsTableSeeder blog\n```\n\nSeed from the specified module.\n\n```\nphp artisan module:db-seed blog\n```\n\nSeed from all modules.\n\n```\nphp artisan module:db-seed\n```\n\nCreate new controller for the specified module.\n\n```\nphp artisan module:make-controller SiteController blog\n```\n\nPublish assets from the specified module to public directory.\n\n```\nphp artisan module:link blog\n```\n\nPublish assets from all modules to public directory.\n\n```\nphp artisan module:link\n```\n\nCreate new model for the specified module.\n\n```\nphp artisan module:make-model User blog\n```\n\nCreate new service provider for the specified module.\n\n```\nphp artisan module:make-provider MyServiceProvider blog\n```\n\nCreate new policy for the specified module.\n\n```\nphp artisan module:make-policy PostsPolicy blog\n```\n\nCreate new route provider for the specified module.\n\n```\nphp artisan module:make-route blog\n```\n\nCreate new form request for the specified module.\n\n```\nphp artisan module:make-request CreateRequest blog\n```\n\nCreate new event for the specified module.\n\n```\nphp artisan module:make-event CreateEvent blog\n```\n\nCreate new job for the specified module.\n\n```\nphp artisan module:make-job CreateJob blog\n```\n\nCreate new listener for the specified module.\n\n```\nphp artisan module:make-listener CreateListener blog --event=\"App\\Modules\\Blog\\Events\\CreateEvent\"\n```\n\nCreate new middleware for the specified module.\n\n```\nphp artisan module:make-middleware CreateNewPostMiddleware blog\n```\n\nCreate new mail for the specified module.\n\n```\nphp artisan module:make-mail WelcomeEmail checkout\n#OR\nphp artisan module:make-mail WelcomeEmail checkout --markdown=emails.checkout.shipped\n```\n\nCreate new notification for the specified module.\n\n```\nphp artisan module:make-notification InvoicePaid checkout\n#OR\nphp artisan module:make-notification InvoicePaid checkout --markdown=notifications.checkout.shipped\n```\n\nEnable the specified module.\n\n\n```\nphp artisan module:enable blog\n```\n\nDisable the specified module.\n\n```\nphp artisan module:disable blog\n```\n\nUpdate dependencies for the specified module.\n\n```\nphp artisan module:update blog\n```\n\nUpdate dependencies for all modules.\n\n```\nphp artisan module:update\n```\n\nShow the list of modules.\n\n```\nphp artisan module:list\n```\n\n## Facades\n\n### Using Model Factories\n\nNormally, you can use [model factories](https://laravel.com/docs/5.4/database-testing#writing-factories) to conveniently generate large amounts of database records.\nI have defined new way to writing seeder for the specified module.\n\n```php\nModule::factory(App\\User::class, 50)-\u003ecreate()-\u003eeach(function ($u) {\n    $u-\u003eposts()-\u003esave(factory(App\\Post::class)-\u003emake());\n});\n```\n\nGet all modules.\n\n```php\nModule::all();\n```\n\nGet all cached modules.\n\n```php\nModule::getCached()\n```\n\nGet ordered modules. The modules will be ordered by the `priority` key in `module.json` file.\n\n```php\nModule::getOrdered();\n```\n\nGet scanned modules.\n\n```php\nModule::scan();\n```\n\nFind a specific module.\n\n```php\nModule::find('name');\n#OR\nModule::get('name');\n```\n\nFind a module, if there is one, return the `Module` instance, otherwise throw `Llama\\Modules\\Exeptions\\ModuleNotFoundException`.\n\n```php\nModule::findOrFail('module-name');\n```\n\nGet scanned locations.\n\n```php\nModule::getScannedLocations();\n```\n\nGet all modules as a collection instance.\n\n```php\nModule::toCollection();\n```\n\nGet modules by the status. 1 for active and 0 for inactive.\n\n```php\nModule::getByStatus(1);\n```\n\nCheck the specified module. If it exists, will return `true`, otherwise `false`.\n\n```php\nModule::has('blog');\n```\n\nGet all enabled modules.\n\n```php\nModule::activated();\n```\n\nGet all disabled modules.\n\n```php\nModule::deactivated();\n```\n\nGet count of all modules.\n\n```php\nModule::count();\n```\n\nGet module path.\n\n```php\nModule::getPath();\n```\n\nRegister the modules.\n\n```php\nModule::register();\n```\n\nBoot all available modules.\n\n```php\nModule::boot();\n```\n\nGet all enabled modules as collection instance.\n\n```php\nModule::collections();\n```\n\nGet module path from the specified module.\n\n```php\nModule::getModulePath('name');\n```\n\nGet assets path from the specified module.\n\n```php\nModule::assetPath('name');\n```\n\nGet config value from this package.\n\n```php\nModule::config('composer.vendor');\n```\n\nGet used storage path.\n\n```php\nModule::getUsedStoragePath();\n```\n\nGet used module for cli session.\n\n```php\nModule::used();\n```\n\nSet used module for cli session.\n\n```php\nModule::used('name');\n```\n\nGet modules's assets path.\n\n```php\nModule::getAssetsPath();\n```\n\nGet modules's namespace.\n\n```php\nModule::getNamespace();\n```\n\nGet asset url from specific module.\n\n```php\nModule::asset('blog::img/logo.img');\n```\n\nInstall the specified module by given module name.\n\n```php\nModule::install('llama-laravel-modules/hello');\n```\n\nUpdate dependencies for the specified module.\n\n```php\nModule::update('hello');\n```\n\n## Entity\n\nGet an entity from a specific module.\n\n```php\n$module = Module::find('blog');\n```\n\nGet module name.\n\n```php\n$module-\u003egetName();\n```\n\nGet module name in lowercase.\n\n```php\n$module-\u003egetLowerName();\n```\n\nGet module name in studlycase.\n\n```php\n$module-\u003egetStudlyName();\n```\n\nGet module path.\n\n```php\n$module-\u003egetPath();\n```\n\nGet extra path.\n\n```php\n$module-\u003egetExtraPath('assets');\n```\n\nDisable the specified module.\n\n```php\n$module-\u003edisable();\n```\n\nEnable the specified module.\n\n```php\n$module-\u003eenable();\n```\n\nDelete the specified module.\n\n```php\n$module-\u003edelete();\n```\n\nGet namespace specified module.\n\n```php\n$module-\u003egetNamespace();\n```\n\n## Custom Namespaces\n\nWhen you create a new module it also registers new custom namespace for `Lang`, `View` and `Config`. For example, if you create a new module named blog, it will also register new namespace/hint blog for that module. Then, you can use that namespace for calling `Lang`, `View` or `Config`. Following are some examples of its usage:\n\nCalling Lang:\n\n```php\nLang::get('blog::group.name');\n#OR\ntrans('blog::group.name');\n```\n\nCalling View:\n\n```php\nView::make('blog::index');\n#OR\nView::make('blog::partials.sidebar');\n```\n\nCalling Config:\n\n```php\nConfig::get('blog.name');\n#OR\nconfig('blog.name');\n```\n\n## Publishing Modules\n\nHave you created a laravel modules? Yes, I've. Then, I want to publish my modules. Where do I publish it? That's the question. What's the answer ? The answer is [Packagist](http://packagist.org).\n\n### Auto Scan Vendor Directory\n\nBy default the `vendor` directory is not scanned automatically, you need to update the configuration file to allow that. Set `scan.enabled` value to `true`. For example:\n\n```php\n// file config/modules.php\n\nreturn [\n  //...\n  'scan' =\u003e [\n    'enabled' =\u003e true\n  ]\n  //...\n];\n```\n\nYou can verify the module has been installed using `module:list` command:\n\n```\nphp artisan module:list\n```\n\n## Publishing Modules\n\nAfter creating a module and you are sure your module module will be used by other developers. You can push your module to [github](https://github.com) or [bitbucket](https://bitbucket.org) and after that you can submit your module to the packagist website.\n\nYou can follow this step to publish your module.\n\n1. Create A Module.\n2. Push the module to github.\n3. Submit your module to the packagist website.\n\nSubmit to packagist is very easy, just give your github repository, click submit and you done.\n\n\n## Credits\n\n- [XuaNguyen](https://github.com/xuanhoa88)\n- [All Contributors](../../contributors)\n\n## About XuaNguyen\n\nXuaNguyen is a freelance web developer specialising on the laravel framework.\n\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuanhoa88%2Flaravel-modules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxuanhoa88%2Flaravel-modules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuanhoa88%2Flaravel-modules/lists"}