{"id":34004444,"url":"https://github.com/derrandz/multilayering","last_synced_at":"2026-04-02T03:19:33.622Z","repository":{"id":36230935,"uuid":"40535255","full_name":"derrandz/multilayering","owner":"derrandz","description":"A little package to speed up the work flow when using the 'multilayer' conventions.","archived":false,"fork":false,"pushed_at":"2016-01-28T14:00:00.000Z","size":34,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-14T22:13:30.864Z","etag":null,"topics":["conventions","design-patterns","hmvc","laravel","multiverse","mvc","php","producvity","quality"],"latest_commit_sha":null,"homepage":"https://coderwall.com/p/itnqyq/alternatives-to-hmvc-with-laravel","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/derrandz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-11T10:11:33.000Z","updated_at":"2018-10-02T09:37:43.000Z","dependencies_parsed_at":"2022-09-02T23:20:25.916Z","dependency_job_id":null,"html_url":"https://github.com/derrandz/multilayering","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/derrandz/multilayering","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derrandz%2Fmultilayering","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derrandz%2Fmultilayering/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derrandz%2Fmultilayering/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derrandz%2Fmultilayering/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/derrandz","download_url":"https://codeload.github.com/derrandz/multilayering/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derrandz%2Fmultilayering/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31295054,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T01:43:37.129Z","status":"online","status_checked_at":"2026-04-02T02:00:08.535Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["conventions","design-patterns","hmvc","laravel","multiverse","mvc","php","producvity","quality"],"created_at":"2025-12-13T10:05:23.306Z","updated_at":"2026-04-02T03:19:33.607Z","avatar_url":"https://github.com/derrandz.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multilayering\n\n[![Software License][ico-license]](LICENSE.md)\n\nThis package is a tiny laravel package that generates artisan commands to generate the multilayer conventions faster, and speed up the workflow.\n\nIf you don't know what multilayer is , feel free to have quick read at [coderwall](https://coderwall.com/p/itnqyq/alternatives-to-hmvc-with-laravel)\n## Install\n\nVia Composer\n\n``` bash\n$ composer require hamzaouaghad/multilayering\n```\n\n## Usage\n\nMake sure you add this line in your `Config\\app.php`\n``` php\n 'providers' =\u003e [\n\n Hamzaouaghad\\Multilayering\\MultilayerGeneratorServiceProvider::class,\n Hamzaouaghad\\Multilayering\\RegisterCommandsServiceProvider::class,\n\n ],\n```\n\nsave and run\n\n```bash\n $ composer dumpautoload -o\n $ php artisan vendor:publish\n ```\n Now to go your 'app/providers/', you will find a new providers added :\n\n`MultilayerGeneratorServiceProvider`\n\n If it's your first time, and you still need to generate the new folder structure, please run:\n \n ```bash\n php artisan make:multilayer\n ```\n\n And afterwards, again, add this to your providers:\n ```php\n App\\Providers\\MultilayerGeneratorServiceProvider`.\n```\n\nAgain,\n\n```bash\n$ composer dumpautoload -o\n$ php artisan vendor:publish\n```\n\nI could easily automate the process of adding all of these service providers and calling them for you, however, this is never the best approach, if not a bad practice, as adding them manually -unlinke automatic registering- actually keeps track of all of the service providers you are using, in your providers array.\n\nSo bare the pain of keeping your work organized, it's worth it.\n\n If you wish to quicken the paste, and bake all, you may use the following command :\n ```bash\n php artisan bake:all ClassName\n ```\n This command will generate an eloquent class, an interface for it, and a repository that uses this interface. Also, at the http layer, it generates a motor for it that injects that repository.\n\n If you may to bake all with specifics, you may use the following options:\n```bash\n--interface : The name of the interface to be created for our calss\n--motor : the name of the motor to be created for our class\n--trait : the name of the trait that your motor maye use\n--repository : the name of the repository that this class would be covered under.\n```\n\nAfter each file generation, you'll have to run \n\n```php\n\n$ php artisan vendor:publish\n\n```\n\nAs it will mention to you everytime, so I think you won't forget.\n\n\n##Examples \n\n```bash\nphp artisan bake:all User --repository=Accounts --interface=Security --motor=STAFF --trait=Authentication\n```\n\nThis will create :\n\n```php\nclass User extends Eloquent\n```\nand\n```php\ninterface SecurityInterface\n```\nand\n\n```php\nclass AccountsRepository implements SecurityInterface\n```\n\nand\n\n```php\nclass STAFFmotor extends Motor\n{\n public function __construct(AccountsRepository $repo)\n {\n    $this-\u003erepository = $repo;\n }\n\n use /Authentication;\n}\n```\n\nAfter all of this, the  `Providers\\MultilayerGeneratorServiceProvider` will be updated as follows :\n\n```php\n\nclass MultilayerGeneratorServiceProvider extends ServiceProvider\n{\n    /**\n     * Bootstrap the application services.\n     *\n     * @return void\n     */\n    public function boot()\n    {\n        //\n    }\n\n    /**\n     * Register the application services.\n     *\n     * @return void\n     */\n    public function register()\n    {\n        $this-\u003eapp-\u003ebooting(function(){\n            $loader = \\Illuminate\\Foundation\\AliasLoader::getInstance();\n        /*\n         |\n         | Repositories Classes\n         |\n         */\n\n             $loader-\u003ealias('AccountsRepository', 'App\\DataLayer\\Repositories\\AccountsRepository');\n             $loader-\u003ealias('AccountsRepoInterface', 'AccountsRepository');\n            \n        /*\n         |\n         | Object Classes\n         |\n         */\n         \n             $loader-\u003ealias('User', 'App\\DataLayer\\Objects\\User');\n\n        /*\n         |\n         | Traits \n         |  \n         */\n            $loader-\u003ealias('CRUDtrait', 'App\\Http\\Traits\\CRUDtrait');//don't modify this.\n            $loader-\u003ealias('AuthenticationTrait', 'App\\Http\\Traits\\AuthenticationTrait');\n\n        /*\n         |\n         | Motors\n         |  \n         */\n\n            $loader-\u003ealias('Motor', 'App\\Http\\Motors\\Motor');\n            $loader-\u003ealias('STAFFmotor', 'App\\Http\\Controllers\\Motors\\STAFFmotor');\n        });\n    }\n}\n\n```\n\n Available commands\n```bash\n\n bake\n  bake:all                   Creates an eloquent class, an interface and a repository for it, also a motor, and a trait if specified.\n  bake:datalayer             Bake the data layer for the given class\n make\n  make:controller            Create a new resource controller class\n  make:datalayer             Creates the datalayer directory structure\n  make:datalayer:class       Creates an eloquent class, its interface and its repository.\n  make:datalayer:interface   Creates an interface.\n  make:datalayer:repository  Creates a repository\n  make:httplayer             Creates the httplayer directory structure\n  make:httplayer:basemotor   Creates an abstract motor class for inheritence.\n  make:httplayer:motor       Creates a motor, with the injected specified repository, and the trait to be used.\n  make:httplayer:trait\n  make:multilayer            This command generates the directory structure for the multilayering conventions.\n  \n```\n\n\nIf you wish to go your own way, without mass baking, you can use the following\n\n```bash\nphp artisan make:datalayer:class \u003cname\u003e\n\nphp artisan make:datalayer:interface \u003cname\u003e\n\nphp artisan make:datalayer:repository \u003cname\u003e (with options: --interface= the one you wish your repo to implement, --class=The class whose repo is this\n\nphp artisan make:httplayer:motor \u003cname\u003e  --trait= : The trait that is desired to be used --repository= : A specific repository to be implemented\n\nphp artisan make:httplayer:trait \u003cname\u003e\n\n```\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security\n\nIf you discover any security related issues, please email ouaghad.hamza@gmail.com instead of using the issue tracker.\n\n## Credits\n\n- [Hamza Ouaghad](https://twitter.com/hamza_ouaghad)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[ico-version]: https://img.shields.io/packagist/v/league/:package_name.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-travis]: https://img.shields.io/travis/thephpleague/:package_name/master.svg?style=flat-square\n[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/thephpleague/:package_name.svg?style=flat-square\n[ico-code-quality]: https://img.shields.io/scrutinizer/g/thephpleague/:package_name.svg?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/league/:package_name.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/league/:package_name\n[link-travis]: https://travis-ci.org/thephpleague/:package_name\n[link-scrutinizer]: https://scrutinizer-ci.com/g/thephpleague/:package_name/code-structure\n[link-code-quality]: https://scrutinizer-ci.com/g/thephpleague/:package_name\n[link-downloads]: https://packagist.org/packages/league/:package_name\n[link-author]: https://github.com/:author_username\n[link-contributors]: ../../contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderrandz%2Fmultilayering","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fderrandz%2Fmultilayering","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderrandz%2Fmultilayering/lists"}