meritum/sage
Composer 安装命令:
composer create-project meritum/sage
包简介
Meritum CLI application scaffold
README 文档
README
Sage is a composer create-project scaffold for building CLI applications with the Meritum ecosystem. It ships a pre-wired meritum/cli kernel with a clean structure ready to build on.
Requirements
- PHP 8.4+
- Composer
Getting Started
composer create-project meritum/sage my-app
cd my-app
Copy .env.example to .env and adjust as needed:
APP_NAME='My App'
APP_ENV=local
APP_DEBUG=true
Run the application:
php bin/sage
Dev Environment
Sage ships with a devenv.nix for devenv:
devenv shell
PHP extensions and services (PostgreSQL, Redis, etc.) can be added in devenv.nix.
Adding a Command
Create a command class in src/Command/:
namespace App\Command; use Meritum\Cli\ExitCode; use Meritum\Cli\Command\Command; use Meritum\Cli\Output\SageStyleInterface; final class HelloCommand extends Command { public function __invoke(SageStyleInterface $io): ExitCode { $io->success('Hello, world!'); return ExitCode::Success; } }
Register it in AppModule::register():
$kernel->define(HelloCommand::class, function (): HelloCommand { $command = new HelloCommand(); $command->setName('hello')->setDescription('Say hello'); return $command; })->tag(CliKernelOption::CommandTag->value);
Structure
bin/sage Entry point
src/
ModuleRepository.php Register application modules
AppModule.php Register commands and application config
tests/
devenv.nix Dev environment
Testing
composer test
Further Reading
- meritum/cli — CLI kernel, commands, IO
- georgeff/kernel — DI, modules, service tagging
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-17