{"id":15898702,"url":"https://github.com/leafsphp/aloe","last_synced_at":"2025-03-20T16:32:49.614Z","repository":{"id":43354925,"uuid":"320727938","full_name":"leafsphp/aloe","owner":"leafsphp","description":"Stupidly smart and simple console for your Leaf apps","archived":false,"fork":false,"pushed_at":"2023-09-12T20:04:39.000Z","size":208,"stargazers_count":5,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-23T06:33:17.562Z","etag":null,"topics":["aloe-cli","leaf-api","leaf-mvc"],"latest_commit_sha":null,"homepage":"https://leafphp.dev/aloe-cli/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leafsphp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"open_collective":"leaf","github":"leafsphp"}},"created_at":"2020-12-12T02:07:14.000Z","updated_at":"2024-01-05T15:04:24.000Z","dependencies_parsed_at":"2022-08-19T21:40:24.662Z","dependency_job_id":"67ad38e0-8663-4d6a-a4ea-94d7ae22d98c","html_url":"https://github.com/leafsphp/aloe","commit_stats":{"total_commits":122,"total_committers":5,"mean_commits":24.4,"dds":0.05737704918032782,"last_synced_commit":"713ff39ddad83f29d19917b5f4b5c90902f2c885"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafsphp%2Faloe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafsphp%2Faloe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafsphp%2Faloe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafsphp%2Faloe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leafsphp","download_url":"https://codeload.github.com/leafsphp/aloe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221106571,"owners_count":16757223,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["aloe-cli","leaf-api","leaf-mvc"],"created_at":"2024-10-06T10:07:46.909Z","updated_at":"2024-10-28T05:20:31.352Z","avatar_url":"https://github.com/leafsphp.png","language":"PHP","readme":"\u003c!-- markdownlint-disable no-inline-html --\u003e\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://leafphp.dev/logo-circle.png\" height=\"100\"/\u003e\n    \u003cbr\u003e\u003cbr\u003e\n\u003c/p\u003e\n\n# Aloe CLI\n\n[![Latest Stable Version](https://poser.pugx.org/leafs/leaf/v/stable)](https://packagist.org/packages/leafs/leaf)\n[![Total Downloads](https://poser.pugx.org/leafs/leaf/downloads)](https://packagist.org/packages/leafs/leaf)\n[![License](https://poser.pugx.org/leafs/leaf/license)](https://packagist.org/packages/leafs/leaf)\n\nAloe is a CLI tool that comes with Leaf API and Leaf MVC v2 upwards. It ties into the Leaf console tool and totally replaces all it's functionality. Aloe exists at the root of your application in the `leaf` script and provides a number of helpful commands that can assist you while you build your application. To view all available commands, you can use the `list` command or call `leaf`.\n\n```sh\nphp leaf list\n# or\nphp leaf\n```\n\nEvery command also includes a \"help\" screen which displays and describes the command's available arguments and options. To view a help screen, precede the name of the command with help:\n\n```sh\nphp leaf help db:migrate\n```\n\n## Interact (REPL)\n\nAloe comes with aloe-interact which is basically powerful REPL powered by [PSY Shell](https://github.com/bobthecow/psysh). Interact allows you to interact with your app, access variables and methods in your Leaf app, run and rollback migrations, perform database operations and so much more. You can access interact on aloe like this:\n\n```sh\nphp leaf interact\n```\n\n## Writing Commands\n\nAside all the commands provided by aloe, you can also create your own commands and run them through the aloe cli. Aloe CLI allows you to directly generate commands to run in the CLI.\n\n### Generating Commands\n\nTo create a new command, you may use the `g:command` aloe command. This command will create a new command class in the default commands directory.\n\nThe default directory for commands in Leaf API and Leaf MVC is `App\\Console`, with skeleton, you're free to decide where to place your commands.\n\n```sh\nphp leaf g:command SendMail\n```\n\nAloe can also generate namespaced commands directly for you. You don't have to manually set namespaces as done with other CLI tools.\n\n```sh\nphp leaf g:command mail:send\n```\n\nIf you want to, you can even generate the command by it's name instead of it's class. Aloe is smart enough to differentiate them.\n\n```sh\nphp leaf g:command shutdown \n```\n\n### Command Structure\n\nAfter generating your command, you should start writing what to execute once the command is called. Aloe smartly generates a command name for you, even if you create the command using the class name, however, if it doesn't match what you need, you can always change it.\n\nWith the `mail:send` example above, Aloe wil generate `App\\Console\\MailSendCommand`, in this file, we'll have something that looks like this:\n\n```php\n\u003c?php\nnamespace App\\Console;\n\nuse Aloe\\Command;\n\nclass ExampleCommand extends Command\n{\n    protected static $defaultName = \"mail:send\";\n    public $description = \"mail:send command's description\";\n    public $help = \"mail:send command's help\";\n\n    public function handle()\n    {\n        $this-\u003ecomment(\"mail:send command's output\");\n    }\n}\n\n```\n\nWe can add an argument to find the user to send the email to, and output a message while sending the email.\n\n```php\npublic function config()\n{\n    $this-\u003esetArgument(\"user\", \"required\");\n}\n\npublic function handle()\n{\n    $user = $this-\u003eargument('user');\n\n    $this-\u003ecomment(\"Sending email to $user\");\n\n    $success = \\CustomEmailHandler::send($user);\n\n    if ($success) {\n        $this-\u003einfo(\"Email sent successfully\");\n    } else {\n        $this-\u003eerror(\"Couldn't send email, pls try again\");\n    }\n}\n```\n\n### Registering Commands\n\nBy default, aloe cli registers all commands generated, however, if you have a command you want to register manually, or commands from a package which need to use Aloe, you can also add them pretty easily.\n\nSimply locate the `aloe` file in the root directory of your project, open it up and find a commented section talking about custom commands.\n\n```php\n/*\n|--------------------------------------------------------------------------\n| Add custom command\n|--------------------------------------------------------------------------\n|\n| If you have a new command to add to Leaf\n|\n*/\n$aloe-\u003eregister(\\App\\Console\\ExampleCommand::class);\n```\n\nAn example command has already been registered, so you can follow this example. Simply call the `register` method. You can also pass in an array of commands to register, as such, a custom package with a couple of commands to register can simply return an array of all those commands.\n\n```php\n$aloe-\u003eregister([\n    \\App\\Console\\AppCommand::class,\n    CustomPackage::commands(),\n]);\n```\n\n## 💬 Stay In Touch\n\n- [Twitter](https://twitter.com/leafphp)\n- [Join the forum](https://github.com/leafsphp/leaf/discussions/37)\n- [Chat on discord](https://discord.com/invite/Pkrm9NJPE3)\n\n## 📓 Learning Leaf 3\n\n- Leaf has a very easy to understand [documentation](https://leafphp.dev) which contains information on all operations in Leaf.\n- You can also check out our [youtube channel](https://www.youtube.com/channel/UCllE-GsYy10RkxBUK0HIffw) which has video tutorials on different topics\n- We are also working on codelabs which will bring hands-on tutorials you can follow and contribute to.\n\n## 😇 Contributing\n\nWe are glad to have you. All contributions are welcome! To get started, familiarize yourself with our [contribution guide](https://leafphp.dev/community/contributing.html) and you'll be ready to make your first pull request 🚀.\n\nTo report a security vulnerability, you can reach out to [@mychidarko](https://twitter.com/mychidarko) or [@leafphp](https://twitter.com/leafphp) on twitter. We will coordinate the fix and eventually commit the solution in this project.\n\n### Code contributors\n\n\u003ctable\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd align=\"center\"\u003e\n\t\t\t\u003ca href=\"https://github.com/mychidarko\"\u003e\n\t\t\t\t\u003cimg src=\"https://avatars.githubusercontent.com/u/26604242?v=4\" width=\"120px\" alt=\"\"/\u003e\n\t\t\t\t\u003cbr /\u003e\n\t\t\t\t\u003csub\u003e\n\t\t\t\t\t\u003cb\u003eMichael Darko\u003c/b\u003e\n\t\t\t\t\u003c/sub\u003e\n\t\t\t\u003c/a\u003e\n\t\t\u003c/td\u003e\n        \u003ctd align=\"center\"\u003e\n\t\t\t\u003ca href=\"https://github.com/pjotrsavitski\"\u003e\n\t\t\t\t\u003cimg src=\"https://avatars.githubusercontent.com/u/518331?v=4\" width=\"120px\" alt=\"\"/\u003e\n\t\t\t\t\u003cbr /\u003e\n\t\t\t\t\u003csub\u003e\n\t\t\t\t\t\u003cb\u003ePjotr Savitski\u003c/b\u003e\n\t\t\t\t\u003c/sub\u003e\n\t\t\t\u003c/a\u003e\n\t\t\u003c/td\u003e\n        \u003ctd align=\"center\"\u003e\n\t\t\t\u003ca href=\"https://github.com/Aminur670\"\u003e\n\t\t\t\t\u003cimg src=\"https://avatars.githubusercontent.com/u/32174602?v=4\" width=\"120px\" alt=\"\"/\u003e\n\t\t\t\t\u003cbr /\u003e\n\t\t\t\t\u003csub\u003e\n\t\t\t\t\t\u003cb\u003eAminur Rahaman\u003c/b\u003e\n\t\t\t\t\u003c/sub\u003e\n\t\t\t\u003c/a\u003e\n\t\t\u003c/td\u003e\n\t\u003c/tr\u003e\n\u003c/table\u003e\n\n## 🤩 Sponsoring Leaf\n\nYour cash contributions go a long way to help us make Leaf even better for you. You can sponsor Leaf and any of our packages on [open collective](https://opencollective.com/leaf) or check the [contribution page](https://leafphp.dev/support/) for a list of ways to contribute.\n\nAnd to all our existing cash/code contributors, we love you all ❤️\n\n### Cash contributors\n\n\u003ctable\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd align=\"center\"\u003e\n\t\t\t\u003ca href=\"https://opencollective.com/aaron-smith3\"\u003e\n\t\t\t\t\u003cimg src=\"https://images.opencollective.com/aaron-smith3/08ee620/avatar/256.png\" width=\"120px\" alt=\"\"/\u003e\n\t\t\t\t\u003cbr /\u003e\n\t\t\t\t\u003csub\u003e\u003cb\u003eAaron Smith\u003c/b\u003e\u003c/sub\u003e\n\t\t\t\u003c/a\u003e\n\t\t\u003c/td\u003e\n\t\t\u003ctd align=\"center\"\u003e\n\t\t\t\u003ca href=\"https://opencollective.com/peter-bogner\"\u003e\n\t\t\t\t\u003cimg src=\"https://images.opencollective.com/peter-bogner/avatar/256.png\" width=\"120px\" alt=\"\"/\u003e\n\t\t\t\t\u003cbr /\u003e\n\t\t\t\t\u003csub\u003e\u003cb\u003ePeter Bogner\u003c/b\u003e\u003c/sub\u003e\n\t\t\t\u003c/a\u003e\n\t\t\u003c/td\u003e\n\t\t\u003ctd align=\"center\"\u003e\n\t\t\t\u003ca href=\"#\"\u003e\n\t\t\t\t\u003cimg src=\"https://images.opencollective.com/guest-32634fda/avatar.png\" width=\"120px\" alt=\"\"/\u003e\n\t\t\t\t\u003cbr /\u003e\n\t\t\t\t\u003csub\u003e\u003cb\u003eVano\u003c/b\u003e\u003c/sub\u003e\n\t\t\t\u003c/a\u003e\n\t\t\u003c/td\u003e\n\t\u003c/tr\u003e\n\u003c/table\u003e\n\n## 🤯 Links/Projects\n\n- [Aloe CLI](https://leafphp.dev/aloe-cli/)\n- [Leaf Docs](https://leafphp.dev)\n- [Leaf MVC](https://mvc.leafphp.dev)\n- [Leaf API](https://api.leafphp.dev)\n- [Leaf CLI](https://cli.leafphp.dev)\n","funding_links":["https://opencollective.com/leaf","https://github.com/sponsors/leafsphp","https://opencollective.com/aaron-smith3","https://opencollective.com/peter-bogner"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleafsphp%2Faloe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleafsphp%2Faloe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleafsphp%2Faloe/lists"}