{"id":13405096,"url":"https://github.com/minicli/minicli","last_synced_at":"2025-05-13T22:00:18.785Z","repository":{"id":38069104,"uuid":"209816691","full_name":"minicli/minicli","owner":"minicli","description":"A minimalist framework for command-line applications in PHP","archived":false,"fork":false,"pushed_at":"2025-04-08T18:59:25.000Z","size":319,"stargazers_count":1063,"open_issues_count":9,"forks_count":58,"subscribers_count":19,"default_branch":"main","last_synced_at":"2025-05-07T20:03:46.055Z","etag":null,"topics":["cli","command-line","command-line-tools","hacktoberfest","php"],"latest_commit_sha":null,"homepage":"https://docs.minicli.dev/","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/minicli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":["erikaheidi"]}},"created_at":"2019-09-20T14:58:30.000Z","updated_at":"2025-05-05T04:30:28.000Z","dependencies_parsed_at":"2024-01-14T02:22:19.195Z","dependency_job_id":"3c3df278-70c1-4c52-8d31-99e1dc4fb14b","html_url":"https://github.com/minicli/minicli","commit_stats":{"total_commits":128,"total_committers":22,"mean_commits":5.818181818181818,"dds":0.7265625,"last_synced_commit":"e9e0bad815160e5462d815902d6ca00b1a3c411e"},"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minicli%2Fminicli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minicli%2Fminicli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minicli%2Fminicli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minicli%2Fminicli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/minicli","download_url":"https://codeload.github.com/minicli/minicli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253401747,"owners_count":21902724,"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":["cli","command-line","command-line-tools","hacktoberfest","php"],"created_at":"2024-07-30T19:01:55.697Z","updated_at":"2025-05-13T22:00:18.748Z","avatar_url":"https://github.com/minicli.png","language":"PHP","funding_links":["https://github.com/sponsors/erikaheidi"],"categories":["PHP","Table of Contents","Additional Languages","[PHP](https://www.php.net/)"],"sub_categories":["Micro Frameworks","PHP 🐘","Useful awesome list for Go cli","Framework"],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://docs.minicli.dev/en/latest/images/logo/minicli_logo_term_pink.png\" align=\"center\" alt=\"logo\" title=\"Minicli logo\" alt=\"Minicli Logo\" width=\"160\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"//packagist.org/packages/minicli/minicli\"\u003e\n        \u003cimg src=\"https://poser.pugx.org/minicli/minicli/v\" alt=\"Latest Stable Version\" title=\"Latest Stable Version\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"//packagist.org/packages/minicli/minicli\"\u003e\n        \u003cimg src=\"https://poser.pugx.org/minicli/minicli/downloads\" alt=\"Total Downloads\" title=\"Total Downloads\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"//packagist.org/packages/minicli/minicli\"\u003e\n        \u003cimg src=\"https://poser.pugx.org/minicli/minicli/license\" alt=\"License\" title=\"License\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://docs.minicli.dev/en/latest/?badge=latest\"\u003e\n        \u003cimg src=\"https://readthedocs.org/projects/minicliphp/badge/?version=latest\" alt=\"Documentation Status\" title=\"Documentation Status\"\u003e\n    \u003c/a\u003e\n    \u003ch1 align=\"center\"\u003e\n        Minicli\n    \u003c/h1\u003e\n    \u003ch4 align=\"center\"\u003e\n        Minimalist, dependency-free framework for building CLI-centric PHP applications\n    \u003c/h4\u003e\n\u003c/p\u003e\n\u003chr\u003e\n\n[Minicli](https://docs.minicli.dev) is a minimalist, dependency-free framework for building CLI-centric PHP applications. It provides a structured way to organize your commands, as well as various helpers to facilitate working with command arguments, obtaining input from users, and printing colored output.\n\nQuick links:\n\n- [Documentation](https://docs.minicli.dev)\n- [Demos](https://github.com/minicli/demos)\n- [Contributing](CONTRIBUTING.md)\n- [Contributors](CONTRIBUTORS.md)\n\n## Dependency-free: What Does it Mean\n\nWhat does it mean to be dependency-free? It means that you can build a working CLI PHP application without dozens of nested user-land dependencies. The basic `minicli/minicli` package has only **testing** dependencies, and a single system requirement:\n\n- PHP \u003e= 8.1\n\n\u003e Note: If you want to obtain user input, then the [`readline`](https://www.php.net/manual/en/function.readline.php) PHP extension is required as well.\n\nIt gives you a lot of room to choose your own dependencies.\n\n## Getting Started\n\nThere are two ways to get started. If you want the bare minimum, what we'll call \"Minimalist App\", you can create a single PHP script with your whole application. If you want a more structured application, with commands and subcommands, then you should use Command Namespaces to organize your commands into Controllers.\n\n### Minimalist App\n\nIf you just want to set up a few simple commands to run through `minicli`, all you need to do is to create an `App` and register your commands as anonymous functions.\n\n1. Create an empty project\n2. Run `composer require minicli/minicli` - this will generate a new `composer.json` file.\n3. Create a `minicli` script with the following content:\n\n```php\n#!/usr/bin/env php\n\u003c?php\n\nif (php_sapi_name() !== 'cli') {\n    exit;\n}\n\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse Minicli\\App;\nuse Minicli\\Command\\CommandCall;\n\n$app = new App();\n$app-\u003esetSignature('./minicli mycommand');\n\n$app-\u003eregisterCommand('mycommand', function(CommandCall $input) {\n    echo \"My Command!\";\n\n    var_dump($input);\n});\n\n$app-\u003erunCommand($argv);\n```\n\nThen, make it executable and run `minicli` with your command:\n\n\n```bash\nchmod +x minicli\n./minicli mycommand\n```\n\n### Structured App (Recommended)\n\nFor a more structured application using Controllers and Services, it's best to use [Command Namespaces](https://docs.minicli.dev/en/latest/getting_started/creating-controllers/#creating-command-controllers).\nOur [application template repository](https://github.com/minicli/application) is a great starting point / template to set up Minicli that way.\n\nTo create a new project using the `minicli/application` template, run:\n\n```\ncomposer create-project --prefer-dist minicli/application myapp\n```\n\nThis will generate a directory structure like the following:\n\n```\n.\napp\n└── Command\n    └── Help\n        ├── DefaultController.php\n        ├── TableController.php\n        └── TestController.php\n├── composer.json\n├── docs\n├── LICENSE\n├── minicli\n├── mkdocs.yml\n└── README.md\n\n```\n\nEach directory inside `app/Command` represents a Command Namespace.\nThe classes inside `app/Command/Help` represent subcommands that you can access through the main `help` command.\n\nYou can now run the bootstrapped application with:\n\n```bash\n./minicli help\n```\n\nThe [documentation](https://docs.minicli.dev) contains more detailed information about creating commands and working with output.\n\n## Color Themes\n\nMinicli supports the use of color themes to change the style of command line output. There is currently 3 built-in themes other than the default theme:\n\n- **[Unicorn](https://docs.minicli.dev/en/latest/output/using-themes/#unicorn)**: a more colorful theme.\n- **[Dalton](https://docs.minicli.dev/en/latest/output/using-themes/#dalton)**: a color-blind friendly theme.\n- **[Dracula](https://docs.minicli.dev/en/latest/output/using-themes/#dracula)**: a popular dark theme.\n\nTo set the theme, pass in a configuration array with a `theme` value when initializing App in the script. Built-in themes need a leading `\\` character:\n\n```php\n$app = new App([\n    'theme' =\u003e '\\Unicorn'\n]);\n```\n\nTo use the default built-in theme, do not include the theme configuration setting, or set it to an empty string.\n\nUser-defined themes can also be created and defined in your project. In this case, set the theme name including its namespace without a leading `\\`:\n\n\n```php\n$app = new App([\n    'theme' =\u003e 'App\\Theme\\BlueTheme'\n]);\n```\n\nThe above setting would use the following example theme:\n\n```php\n\u003c?php\n// File: app/Theme/BlueTheme.php\n\nnamespace App\\Theme;\n\nuse Minicli\\Output\\Theme\\DefaultTheme;\nuse Minicli\\Output\\CLIColors;\n\nclass BlueTheme extends DefaultTheme\n{\n    public function getThemeColors(): array\n    {\n        return [\n            'default'     =\u003e [ CLIColors::$FG_BLUE ],\n            'alt'         =\u003e [ CLIColors::$FG_BLACK, CLIColors::$BG_BLUE ],\n            'info'        =\u003e [ CLIColors::$FG_WHITE],\n            'info_alt'    =\u003e [ CLIColors::$FG_WHITE, CLIColors::$BG_BLUE ]\n        ];\n    }\n}\n```\n\nUser-defined themes only need to define styles which will override those in the default theme.\n\n## Contributing\n\nContributions are very welcome! You can contribute with code, documentation, filing issues... Please refer to our [contributing doc](CONTRIBUTING.md) for more information on the contribution process and what we expect from you.\n\n### Running the Test Suite\n\nMinicli uses [Pest PHP](https://pestphp.com) as testing framework. Once you have all dependencies installed via `composer install`, you can run the test suite with:\n\n```bash\n./vendor/bin/pest\n```\n\nTo obtain the code coverage report, you'll need to have `xdebug` installed. Then, you can run:\n\n```bash\n./vendor/bin/pest --coverage\n```\n\nAnd this will give you detailed information about code coverage.\n\n## Building Minicli\n\nThe following tutorials on [dev.to](https://dev.to/erikaheidi) compose a series named \"Building Minicli\", where we create `minicli` from scratch:\n\n - Part 1: [Bootstrapping a CLI PHP Application in Vanilla PHP](https://dev.to/erikaheidi/bootstrapping-a-cli-php-application-in-vanilla-php-4ee) [ [minicli v.0.1.0](https://github.com/erikaheidi/minicli/tree/0.1.0) ]\n - Part 2: [Building minicli: Implementing Command Controllers](https://dev.to/erikaheidi/php-in-the-command-line-implementing-command-controllers-13lh) [ [minicli v.0.1.2](https://github.com/erikaheidi/minicli/tree/0.1.2) ]\n - Part 3: [Building minicli: Autoloading Command Namespaces](https://dev.to/erikaheidi/building-minicli-autoloading-command-namespaces-3ljm) [ [minicli v.0.1.3](https://github.com/erikaheidi/minicli/tree/0.1.3) ]\n - Part 4: [Introducing minicli: a microframework for CLI-centric PHP applications](https://dev.to/erikaheidi/introducing-minicli-a-microframework-for-cli-centric-php-applications-44ik)\n\n_Note: Minicli has evolved a lot since that series was initially written, but that was the base for what Minicli is today._\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminicli%2Fminicli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fminicli%2Fminicli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminicli%2Fminicli/lists"}