{"id":35279663,"url":"https://github.com/fresns/cmd-word-manager","last_synced_at":"2026-05-02T22:01:16.405Z","repository":{"id":46093758,"uuid":"467368774","full_name":"fresns/cmd-word-manager","owner":"fresns","description":"Command word manager helps plugins to communicate with each other easily.","archived":false,"fork":false,"pushed_at":"2025-03-23T17:03:53.000Z","size":126,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"1.x","last_synced_at":"2026-04-09T00:38:05.955Z","etag":null,"topics":["laravel","plugin"],"latest_commit_sha":null,"homepage":"https://pm.fresns.org/command-word/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fresns.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-03-08T04:55:28.000Z","updated_at":"2025-03-23T17:02:09.000Z","dependencies_parsed_at":"2024-03-17T00:14:55.022Z","dependency_job_id":"e4bf9cf2-209b-4553-8d30-d19a6463f8bf","html_url":"https://github.com/fresns/cmd-word-manager","commit_stats":{"total_commits":39,"total_committers":4,"mean_commits":9.75,"dds":"0.33333333333333337","last_synced_commit":"a40324999aac587b922fdb8d14925f0c2c165c88"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/fresns/cmd-word-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fresns%2Fcmd-word-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fresns%2Fcmd-word-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fresns%2Fcmd-word-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fresns%2Fcmd-word-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fresns","download_url":"https://codeload.github.com/fresns/cmd-word-manager/tar.gz/refs/heads/1.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fresns%2Fcmd-word-manager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32550914,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T21:31:48.061Z","status":"ssl_error","status_checked_at":"2026-05-02T21:31:46.574Z","response_time":132,"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":["laravel","plugin"],"created_at":"2025-12-30T14:22:28.969Z","updated_at":"2026-05-02T22:01:16.394Z","avatar_url":"https://github.com/fresns.png","language":"PHP","funding_links":["https://github.com/sponsors/fresns"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003ca href=\"https://fresns.org\" target=\"_blank\"\u003e\u003cimg src=\"https://assets.fresns.com/images/logos/fresns.png\" width=\"300\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://img.shields.io/badge/PHP-%5E8.0-blueviolet\" alt=\"PHP\"\u003e\n\u003cimg src=\"https://img.shields.io/badge/Laravel-9.x%7C10.x%7C11.x%7C12.x%7C13.x-orange\" alt=\"Laravel\"\u003e\n\u003cimg src=\"https://img.shields.io/badge/License-Apache--2.0-green\" alt=\"License\"\u003e\n\u003c/p\u003e\n\n## About\n\nCommand word manager(in laravel) helps plugins(individual functional modules) to communicate with each other easily.\n\n- Guide: [https://pm.fresns.org/command-word/](https://pm.fresns.org/command-word/)\n\n## Sponsors\n\nFresns is an Apache-2.0-licensed open source project with its ongoing development made possible entirely by the support of these awesome backers. If you'd like to join them, please consider [sponsoring Fresns development](https://github.com/sponsors/fresns).\n\n## Install\n\nTo install through Composer, by run the following command:\n\n```bash\ncomposer require fresns/cmd-word-manager\n```\n\n## Using\n\n### Create cmd word service providers\n\n```php\n// Generate cmd word providers: /app/Providers/CmdWordServiceProvider.php\nphp artisan make:cmd-word-provider\n```\n\n```php\n// Generate a cmd word provider for the specified name or directory\nphp artisan make:cmd-word-provider [Name] [--path Name]\n\nphp artisan make:cmd-word-provider FooBar --path Demo\n// path directory: /demo/FooBar/Providers/CmdWordServiceProvider.php\n```\n\n### Registered service providers\n\nIn the `providers` key value of the `/config/app.php` file, add the generated command word service provider.\n\n- `App\\Providers\\CmdWordServiceProvider::class`\n- or\n- `Demo/FooBar/Providers/CmdWordServiceProvider::class`\n\n```php\n\u003c?php\n\nreturn [\n    \u003c...\u003e\n    'providers' =\u003e [\n        \u003c...\u003e\n        App\\Providers\\CmdWordServiceProvider::class,\n    ],\n    \u003c...\u003e\n];\n```\n\n### Mapping command word\n\nIn the properties of the command word provider file `/app/Providers/CmdWordServiceProvider.php`, in `$cmdWordsMap`, add the command word mapping config.\n\n```php\n\u003c?php\n\nnamespace App\\Providers;\n\nuse Plugins\\BarBaz\\Models\\TestModel;\nuse Plugins\\BarBaz\\Services\\AWordService;\nuse Plugins\\BarBaz\\Services\\BWordService;\n\nclass CmdWordServiceProvider extends ServiceProvider implements \\Fresns\\CmdWordManager\\Contracts\\CmdWordProviderContract\n{\n    \u003c...\u003e\n    protected $fsKeyName = 'FooBar';\n\n    protected $cmdWordsMap = [\n        ['word' =\u003e 'test', 'provider' =\u003e [AWordService::class, 'handleTest']],\n        ['word' =\u003e 'staticTest', 'provider' =\u003e [BWordService::class, 'handleStaticTest']],\n        ['word' =\u003e 'modelTest', 'provider' =\u003e [TestModel::class, 'handleModelTest']],\n    ];\n    \u003c...\u003e\n}\n```\n\n### Using cmd words\n\n#### Request input\n\n| Name | Description |\n| --- | --- |\n| `\\FresnsCmdWord` | Cmd Word Facades |\n| `FresnsEmail` | Requesting Object `fskey`, Leaving blank or filling in `Fresns` means that the main program handles the request |\n| `sendEmail` | Command word |\n| `$wordBody` | Parameter list of command word parameters |\n\n```php\n// $parameter list = (parameter array);\n$wordBody = [\n    \"email\" =\u003e \"Mail address\",\n    \"title\" =\u003e \"Mail title\",\n    \"content\" =\u003e \"Mail content\"\n];\n\n// \\facades::plugin('plugin name')-\u003ecmd word($parameter list): Define the contract for the return object\n\\FresnsCmdWord::plugin('FresnsEmail')-\u003esendEmail($wordBody);\n```\n\n**Another way to write**\n\n```php\n\\FresnsCmdWord::plugin('FresnsEmail')-\u003esendEmail([\n    \"email\" =\u003e \"Mail address\",\n    \"title\" =\u003e \"Mail title\",\n    \"content\" =\u003e \"Mail content\"\n]);\n```\n\n#### Result output\n\n| Name | Description |\n| --- | --- |\n| code | Status code |\n| message | Status information |\n| data | Output data |\n\n```json\n// Success\n{\n    \"code\": 0,\n    \"message\": \"ok\",\n    \"data\": {\n        //Command word output data\n    }\n}\n\n// Failure\n{\n    \"code\": 21001,\n    \"message\": \"Plugin does not exist\",\n    \"data\": {\n        //Command word output data\n    }\n}\n```\n\n| Code | Message |\n| --- | --- |\n| 21000 | Unconfigured plugin |\n| 21001 | Plugin does not exist |\n| 21002 | Command word does not exist |\n| 21003 | Command word unknown error |\n| 21004 | Command word not responding |\n| 21005 | Command word request parameter error |\n| 21006 | Command word execution request error |\n| 21007 | Command word response result is incorrect |\n| 21008 | Data anomalies, queries not available or data duplication |\n| 21009 | Execution anomalies, missing files or logging errors |\n| 21010 | Command word function is disabled |\n| 21011 | Incorrect command word configuration |\n\n#### Result processing($fresnsResp)\n\nIf you are standardized to use command word return results, you can use Fresns Response to help you quickly handle the return of the request.\n\n**Example:**\n\n```php\n$fresnsResp = \\FresnsCmdWord::plugin('FresnsEmail')-\u003esendEmail($wordBody);\n```\n\n**Handling abnormal situations**\n\n```php\nif ($fresnsResp-\u003eisErrorResponse()) {\n    return $fresnsResp-\u003egetErrorResponse();\n}\n```\n\n**Handling normal situations**\n\n```php\n$fresnsResp-\u003egetOrigin(); // Obtaining raw data(code+message+data)\n\n$fresnsResp-\u003egetCode(); // Get code only\n$fresnsResp-\u003egetMessage(); // Get only the message\n$fresnsResp-\u003egetData(); // Get only the full amount of data\n$fresnsResp-\u003egetData('user.nickname'); // Get only the parameters specified in data, for example: data.user.nickname\n\n$fresnsResp-\u003eisSuccessResponse(); // Determine if the request is true\n$fresnsResp-\u003eisErrorResponse(); // Determine if the request is false\n\n$fresnsResp-\u003egetErrorResponse(); // Internal use returns raw data, API calls return JSON.\n```\n\n## Contributing\n\nYou can contribute in one of three ways:\n\n1. File bug reports using the [issue tracker](https://github.com/fresns/command-word/issues).\n2. Answer questions or fix bugs on the [issue tracker](https://github.com/fresns/command-word/issues).\n3. Contribute new features or update the wiki.\n\n*The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.*\n\n## License\n\nFresns Command Word Manager is open-sourced software licensed under the [Apache-2.0 license](https://github.com/fresns/cmd-word-manager/blob/main/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffresns%2Fcmd-word-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffresns%2Fcmd-word-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffresns%2Fcmd-word-manager/lists"}