{"id":33993088,"url":"https://github.com/ctasca/mage-bundle","last_synced_at":"2026-04-06T07:02:39.445Z","repository":{"id":59745206,"uuid":"538882368","full_name":"ctasca/mage-bundle","owner":"ctasca","description":"Easily create Magento2/AdobeCommerce PHP/XML/JS files from a set of templates via the command-line.","archived":false,"fork":false,"pushed_at":"2024-08-06T06:29:14.000Z","size":259,"stargazers_count":26,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-14T18:56:28.853Z","etag":null,"topics":["adobe-commerce","magento2","productivity-tools"],"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/ctasca.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-09-20T08:23:18.000Z","updated_at":"2025-11-11T20:15:10.000Z","dependencies_parsed_at":"2023-02-16T17:35:32.536Z","dependency_job_id":"2227a275-bb1b-4a55-a8ab-1b1b86af5a26","html_url":"https://github.com/ctasca/mage-bundle","commit_stats":{"total_commits":208,"total_committers":1,"mean_commits":208.0,"dds":0.0,"last_synced_commit":"62d2eb5d21cb3c63745453ec4e42869cfda31e41"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/ctasca/mage-bundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctasca%2Fmage-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctasca%2Fmage-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctasca%2Fmage-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctasca%2Fmage-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ctasca","download_url":"https://codeload.github.com/ctasca/mage-bundle/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctasca%2Fmage-bundle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31463015,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"online","status_checked_at":"2026-04-06T02:00:07.287Z","response_time":112,"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":["adobe-commerce","magento2","productivity-tools"],"created_at":"2025-12-13T07:02:34.225Z","updated_at":"2026-04-06T07:02:39.440Z","avatar_url":"https://github.com/ctasca.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ctasca/mage-bundle\n[![License](http://poser.pugx.org/phpstan/phpstan/license)](https://packagist.org/packages/phpstan/phpstan) [![PHP Version Require](http://poser.pugx.org/badges/poser/require/php)](https://packagist.org/packages/badges/poser)\n### Easily create Magento2/AdobeCommerce PHP/XML/JS files from a set of templates via the command-line.\n\u003cp\u003eAllows you to define your own templates as well as the data provided at files' creation time.\u003c/p\u003e\n\n## #1 Installation\n```bash\ncomposer require --dev ctasca/mage-bundle\n```\n\n### #2 Copy template files to Magento root dev/ directory\n\n```bash\ncd \u003cmagento_root\u003e/vendor/ctasca/mage-bundle \u0026\u0026 composer run-script post-install-cmd\n```\n\u003cp\u003eAfter executing the above command, check that \u003ccode\u003edev/\u003c/code\u003e directory of your Magento installation contains a \u003ccode\u003emage-bundle/\u003c/code\u003e directory.\u003c/p\u003e\n\n### Enable the module\n```bash\nbin/magento module:enable Ctasca_MageBundle\n```\n\n### Run \u003ccode\u003esetup:upgrade\u003c/code\u003e command\n```bash\nbin/magento setup:upgrade\n```\n\n### Run \u003ccode\u003esetup:di:compile\u003c/code\u003e command (optional)\n\u003cp\u003eIf Magento is running in \u003ccode\u003eproduction\u003c/code\u003e mode you will need to also run:\u003c/p\u003e\n\n```bash\nbin/magento setup:di:compile\n```\n\n## Available commands\n```bash\nbin/magento magebundle:module:create\n```\n#### Shortcut\n```bash\nbin/magento m:modu:c\n```\n\u003cp\u003eCreates a skeleton Magento module in app/code directory, generating the required registration.php and etc/module.xml files\u003c/p\u003e\n\n---\n\n```bash\nbin/magento magebundle:controller:create\n```\n#### Shortcut\n```bash\nbin/magento m:cont:c\n```\n\u003cp\u003eCreates a Controller namespace and Action class in specified module.\nDeveloper is prompted to choose a router (either standard or admin), and an Action template from the ones available in \u003ccode\u003emage-bundle/http-controller\u003c/code\u003e or \u003ccode\u003emage-bundle/adminhtml-http-controller\u003c/code\u003e directories.\u003c/p\u003e\n\n---\n\n```bash\nbin/magento magebundle:etc:xml:create\n```\n#### Shortcut\n```bash\nbin/magento m:e:x:c\n```\n\u003cp\u003eCreates an XML file in Company/Module/etc directory. Templates can be chosen after specifying the area where the template applies to.\u003c/p\u003e\n\n---\n\n```bash\nbin/magento magebundle:model:set:create\n```\n#### Shortcut\n```bash\nbin/magento m:m:s:c\n```\n\u003cp\u003eCreates a Model, Resource Model and Collection classes in specified Company/Module.\u003c/p\u003e\n\n---\n\n```bash\nbin/magento magebundle:repository:create\n```\n#### Shortcut\n```bash\nbin/magento m:r:c\n```\n\u003cp\u003eCreates all the required class for a Repository in specified Company/Module.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eIMPORTANT:\u003c/strong\u003e In order to create a repository a model implementing an interface must exist.\u003c/p\u003e\n\u003cp\u003eIf you need a Repository when creating a model-set with the command \u003ccode\u003emagebundle:model:set:create\u003c/code\u003e you can choose a template that will also create a Model implementing an interface\u003c/p\u003e\n\u003cp\u003eThis command creates the following:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eAn API Interface for the repository\u003c/li\u003e\n\u003cli\u003eAn API Data Interface for the model (if it doesn't exist)\u003c/li\u003e\n\u003cli\u003eAn API Data Search Result Interface\u003c/li\u003e\n\u003cli\u003eThe repository Model implementing the repository Interface\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eDo not forget to add the preferences to your di.xml for the repository classes once created. For example:\u003c/p\u003e\n\n```xml\n\u003cconfig\u003e\n    \u003cpreference for=\"Company\\Module\\Api\\Data\\$MODEL_NAMEInterface\" type=\"Company\\Module\\Model\\$MODEL_NAME\" /\u003e\n    \u003cpreference for=\"Company\\Module\\Api\\$MODEL_NAMERepositoryInterface\" type=\"Company\\Module\\Model\\$MODEL_NAMERepository\" /\u003e\n    \u003cpreference for=\"Company\\Module\\Api\\Data\\$MODEL_NAMESearchResultInterface\" type=\"Company\\Module\\Model\\$MODEL_NAMESearchResult\" /\u003e\n\u003c/config\u003e\n```\n\n---\n\n```bash\nbin/magento magebundle:model:create\n```\n#### Shortcut\n\n```bash\nbin/magento m:mode:c\n```\n\u003cp\u003eCreates a Model class in specified Company/Module. There is also the template to create an interface instead of a class.\u003c/p\u003e\n\n---\n\n```bash\nbin/magento magebundle:block:create\n```\n#### Shortcut\n```bash\nbin/magento m:b:c\n```\n\u003cp\u003eCreates a template Block class in specified Company/Module.\u003c/p\u003e\n\n---\n\n```bash\nbin/magento magebundle:helper:create\n```\n#### Shortcut\n```bash\nbin/magento m:h:c\n```\n\u003cp\u003eCreates a Helper class in specified Company/Module.\u003c/p\u003e\n\n---\n\n```bash\nbin/magento magebundle:customer-data:create\n```\n#### Shortcut\n```bash\nbin/magento m:cu:c\n```\n\u003cp\u003eCreates a CustomerData class in specified Company/Module.\u003c/p\u003e\n\n---\n\n```bash\nbin/magento magebundle:view-model:create\n```\n#### Shortcut\n```bash\nbin/magento m:v:c\n```\n\u003cp\u003eCreates a View Model class in specified Company/Module.\u003c/p\u003e\n\n---\n\n```bash\nbin/magento magebundle:observer:create\n```\n#### Shortcut\n```bash\nbin/magento m:o:c\n```\n\u003cp\u003eCreates an Observer class in specified Company/Module.\u003c/p\u003e\n\n---\n\n```bash\nbin/magento magebundle:plugin:create\n```\n#### Shortcut\n```bash\nbin/magento m:p:c\n```\n\u003cp\u003eCreates a Plugin class in specified Company/Module.\u003c/p\u003e\n\n---\n\n```bash\nbin/magento magebundle:cron:create\n```\n#### Shortcut\n```bash\nbin/magento m:cr:c\n```\n\u003cp\u003eCreates a Cron class in specified Company/Module.\u003c/p\u003e\n\n---\n\n```bash\nbin/magento magebundle:console-command:create\n```\n#### Shortcut\n```bash\nbin/magento m:cons:c\n```\n\u003cp\u003eCreates a Console Command class in specified Company/Module.\u003c/p\u003e\n\n---\n\n```bash\nbin/magento magebundle:data-patch:create\n```\n#### Shortcut\n```bash\nbin/magento m:d:c\n```\n\u003cp\u003eCreates a Setup Data Patch class in specified Company/Module.\u003c/p\u003e\n\n---\n\n```bash\nbin/magento magebundle:schema-patch:create\n```\n#### Shortcut\n```bash\nbin/magento m:s:c\n```\n\u003cp\u003eCreates a Setup Schema Patch class in specified Company/Module.\u003c/p\u003e\n\n---\n\n```bash\nbin/magento magebundle:api-interface:create\n```\n#### Shortcut\n```bash\nbin/magento m:a:c\n```\n\u003cp\u003eCreates an API interface in specified Company/Module. Templates can be chosen after specifying the area where the template applies to.\u003c/p\u003e\n\u003cp\u003eFor functional API interfaces, the generated file will be created in the Company/Module/Api directory\u003c/p\u003e\n\u003cp\u003eFor data API interfaces, the generated file will be created in the Company/Module/Api/Data directory\u003c/p\u003e\n\n---\n\n```bash\nbin/magento magebundle:jquery-widget:create\n```\n#### Shortcut\n```bash\nbin/magento m:j:c\n```\n\u003cp\u003eCreates a JQuery widget file in specified Company/Module. JS file will be created in the specified module's \u003ccode\u003eview/$AREA/web/js\u003c/code\u003e directory.\u003c/p\u003e\n\n---\n\n```bash\nbin/magento magebundle:ui-component:create\n```\n#### Shortcut\n```bash\nbin/magento m:u:c\n```\n\u003cp\u003eCreates an Ui Component JS file in specified Company/Module. JS file will be created in the specified module's \u003ccode\u003eview/$AREA/web/js\u003c/code\u003e directory.\u003c/p\u003e\n\n---\n\n```bash\nbin/magento magebundle:logger:create\n```\n#### Shortcut\n```bash\nbin/magento m:l:c\n```\n\u003cp\u003eCreates a Logger Handler and Logger classes files in specified Company/Module.\u003c/p\u003e\n\u003cp\u003eLog filename can be specified when executing this command.\u003c/p\u003e\n\n---\n\n```bash\nbin/magento magebundle:js:mixin:create\n```\n#### Shortcut\n```bash\nbin/magento m:j:m:c\n```\n\u003cp\u003eCreates a JS mixin file in specified Company/Module. JS file will be created in the specified module's \u003ccode\u003eview/$AREA/web/js\u003c/code\u003e directory.\u003c/p\u003e\n\n---\n\n```bash\nbin/magento magebundle:exception:create\n```\n#### Shortcut\n```bash\nbin/magento m:e:c\n```\n\u003cp\u003eCreates an Exception class in specified Company/Module.\u003c/p\u003e\n\n## Utilities commands\n\n```bash\nbin/magento magebundle:util:encryptor\n```\n#### Shortcut\n```bash\nbin/magento m:u:e\n```\n\u003cp\u003eEncrypts/Decrypts a string using Magento crypt key\u003c/p\u003e\n\n## Setting custom working directory\n\u003cp\u003eBy default, MageBundle creates files in the \u003ccode\u003eapp/code\u003c/code\u003e directory and in the specified module's namespace\u003c/p\u003e\n\u003cp\u003eIt is possible, to change this behaviour by creating a json file named \u003ccode\u003epwd.json\u003c/code\u003e in the \u003ccode\u003e$MAGENTO-ROOT/dev/mage-bundle\u003c/code\u003e directory and specifying the directory (relative to magento root) where files will be created when executing MageBundle commands.\u003c/p\u003e\n\u003cp\u003eThis can be useful, for example, when developing a module which is not located in \u003ccode\u003eapp/code\u003c/code\u003e directory\u003c/p\u003e\n\n### Important:\nThe directory specified in \u003ccode\u003epwd.json\u003c/code\u003e must end with a forward-slash\n\n#### pwd.json example:\n\n```json\n{\n  \"pwd\" : \"packages/my-package/\"\n}\n```\n\n\n## About template files:\n\u003cp\u003eTemplate files are written in PHP version 8.1.\u003c/p\u003e\n\u003cp\u003eFor example the \u003ccode\u003ehttp-get-action-json-result.tpl.php\u003c/code\u003e contains the following\u003c/p\u003e\n\n\u003cpre\u003e\n{{php}}\ndeclare(strict_types=1);\n\nnamespace {{namespace}};\n\nuse Magento\\Framework\\App\\Action\\HttpGetActionInterface;\nuse Magento\\Framework\\App\\RequestInterface;\nuse Magento\\Framework\\Controller\\Result\\JsonFactory;\nuse Magento\\Framework\\Controller\\Result\\Json;\n\nclass {{class_name}} implements HttpGetActionInterface\n{\n    /**\n     * @param RequestInterface $request\n     * @param JsonFactory $jsonFactory\n     */\n    public function __construct(\n        private readonly RequestInterface $request,\n        private readonly JsonFactory $jsonFactory\n    ){}\n\n    /**\n     * @return Json\n     */\n    public function execute(): Json\n    {\n        $jsonResponse = $this-\u003ejsonFactory-\u003ecreate();\n        return $jsonResponse-\u003esetData([]);\n    }\n}\n\u003c/pre\u003e\n\n\u003cp\u003eTo set your own templates just place them in the \u003ccode\u003eMAGENTO_ROOT/dev/mage-bundle/$TEMPLATES_DIRECTORY/\u003c/code\u003e directory and choose the template when executing the magebundle create commands.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eNote:\u003c/strong\u003e When executing the \u003ccode\u003emagebundle:etc:xml:create\u003c/code\u003e command, files are generated with the same name as the template file.\u003cbr\u003eTo create your own templates, use the filename for the xml file to be generated appending __$STRING to the template filename.\u003cbr\u003eFor example to define your own global acl.xml template, create, for example, the template file naming like so: acl__custom.tpl.xml. Then simply place it in the dev/mage-bundle/etc/global directory and select it when executing the create command.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eIMPORTANT:\u003c/strong\u003e If a filename already exists in a module's directory, the create command will not be executed and an error is output to the console.\u003cbr\u003eThis is to prevent overwriting an existing file.\u003c/p\u003e\n\n\u003cp\u003eFor a list of the templates defined within the module go to...\u003c/p\u003e\n\n[The repository wiki page](https://github.com/ctasca/mage-bundle/wiki)\n\n## Templates Data Provider\n\u003cp\u003eIt is possible to define your own templates as well as the data that are passed when these are generated.\u003c/p\u003e\n\u003cp\u003eIn order to do so, simply create a JSON file in the \u003ccode\u003eMAGENTO_ROOT/dev/mage-bundle/custom-data/#path-to-template#\u003c/code\u003e directory, naming the file exactly as the template file that is being generated and defining a JSON Object with setter methods as keys and their corresponding values.\u003c/p\u003e\n\u003cp\u003eAs an example, for XML files generated in \u003ccode\u003eCompany/Module/etc\u003c/code\u003e directories, custom data should be stored in \u003ccode\u003eMAGENTO_ROOT/dev/mage-bundle/custom-data/etc/#area#/#template_name#.tpl.json\u003c/code\u003e\u003c/p\u003e\n\n#### Example\n```json\n{\n  \"setTestNamespace\" : \"\\\\Ctasca\\\\MageBundle\\\\Test\",\n  \"setCustomDataArray\" : [\"First Value\", \"Second Value\"]\n}\n```\n\u003cp\u003eAfter creating this JSON file, it will be possible to use the placeholder \u003ccode\u003e{{test_namespace}}\u003c/code\u003e in a template file.\u003c/p\u003e\n\u003cp\u003eAs \u003ccode\u003esetCustomDataArray\u003c/code\u003e provides an array, this will be imploded with \u003ccode\u003ePHP_EOL\u003c/code\u003e separator. To use it in your template files you would use the placeholder: \u003ccode\u003e{{custom_data_array}}\u003c/code\u003e\u003c/p\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctasca%2Fmage-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fctasca%2Fmage-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctasca%2Fmage-bundle/lists"}