Internal package for the GEMVC framework. It provides shared CLI primitives: typed terminal colors (CliColor), line/box drawing (CliLine), command base (Command), filesystem helpers (FileSystemManager), boxed output (CliBoxShow), codegen abstracts, and install smoke check (InstallControl).
Before you modify code, tests, composer.json, or documentation in this repository, read AI-Assistant.md from top to bottom. That file is the canonical source for:
- GEMVC framework context (HTTP four-layer architecture, CLI discovery, folder layout, how to ship compatible extra CLI packages)
- Quick API reference (every class, method, return type, and short behavior notes)
- Architecture boundaries (what belongs here vs in
gemvc/library) - Template resolution, Composer constraints, testing, and distribution (
archive/export-ignore)
If README.md and AI-Assistant.md disagree, treat AI-Assistant.md as authoritative.
GEMVC is a PHP REST API framework with a fixed four-layer flow (each layer has a clear job; do not skip layers):
| Layer | Typical folder | Role |
|---|---|---|
| API | app/api/ |
HTTP entry, schema validation, auth checks; classes extend ApiService. |
| Controller | app/controller/ |
Orchestrates use cases; calls models. |
| Model | app/model/ |
Business rules, validation, transformations. |
| Table | app/table/ |
Database access via the framework Table / query builder. |
HTTP routing: there are no hand-written route files. URLs map by convention, e.g. /api/{ServiceName}/{methodName} → class in app/api/ and method on that class (see GEMVC docs / main repo .cursorrules).
The gemvc executable ships with gemvc/library (e.g. vendor/bin/gemvc). It loads Composer’s autoloader, parses argv[1] as the command, and maps names like create:service to a PascalCase class name (CreateService) by splitting on : and uppercasing each segment.
Search order (simplified):
- Framework commands — namespace
Gemvc\CLI\Commands\, PHP files undervendor/gemvc/library/src/CLI/commands/(or the monoreposrc/CLI/commands/when developing the framework). - Project commands — namespace
App\CLI\Commands\, files underapp/CLI/commands/in the application repo (yourcomposer.jsonmust autoload that namespace).
The dispatcher does new $commandClass($remainingArgv) then execute(). Commands are plain PHP classes; gemvc/cli-base supplies shared bases (Command, FileSystemManager, CliBoxShow, generator abstracts) so framework and custom commands share the same terminal and filesystem behavior. Colors use the CliColor enum (not string color names).
Where this package fits: gemvc/cli-base is the small dependency with those bases; gemvc/library holds bin/gemvc, concrete Gemvc\CLI\Commands\* implementations, init flows, and HTTP/runtime code.
| Doc | Purpose |
|---|---|
README.md |
Short orientation: what GEMVC is, how CLI discovery works, install pointer, mandatory link for AIs to AI-Assistant.md. |
AI-Assistant.md |
Full API tables, template rules, Composer boundaries, testing, distribution, and deeper notes on extending GEMVC and designing compatible CLI packages (including limits of the stock gemvc binary). |
Put long architecture and “how to build another CLI package” guidance in AI-Assistant.md so one file stays authoritative; keep README.md skimmable.
- Not a supported public API for arbitrary third-party packages.
- Does not depend on
gemvc/library(avoids circular Composer dependencies). - Template fallbacks resolve
gemvc/libraryvia Composer’sInstalledVersionswhen templates are not in the project.
Install with the main framework:
composer require gemvc/library(gemvc/library 5.7+ declares a dependency on gemvc/cli-base.)
composer install
composer test # PHPUnit (tests/Unit)
composer test:coverage # coverage report for src/ (requires PCOV or Xdebug)
composer phpstan # PHPStan level 9 on src/Coverage is configured in phpunit.xml (<source> → src/). See AI-Assistant.md for the full API, template rules, and architecture boundaries.