scriptmancer/sinan 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

scriptmancer/sinan

Composer 安装命令:

composer require scriptmancer/sinan

包简介

Sinan CLI tool for the Nazım framework, wrapping symfony/console.

README 文档

README

A lightweight and powerful CLI tool for the Nazım framework, built on top of Symfony Console.

Installation

composer require scriptmancer/sinan

Usage

Basic Usage

# Run the CLI tool
./sinan

# List available commands
./sinan list

# Get help for a specific command
./sinan help [command]

Creating Commands

Sinan allows you to create new commands using the create:command command:

# Create a command
./sinan create:command Hello

# Create a nested command
./sinan create:command Hello/World

# Create a deeply nested command
./sinan create:command Hello/World/Goodmorning

The commands follow these naming conventions:

Command Path Class Name Signature
./sinan create:command Hello src/Command/Hello/DefaultCommand.php DefaultCommand app:hello
./sinan create:command Hello/World src/Command/Hello/WorldCommand.php WorldCommand app:hello-world
./sinan create:command Hello/World/Goodmorning src/Command/Hello/World/GoodmorningCommand.php GoodmorningCommand app:hello-world-goodmorning

Command Auto-Discovery

Sinan automatically discovers and registers commands from:

  1. Sinan\Command namespace (core commands)
  2. App\Commands namespace (application commands)
  3. Custom namespaces registered via configuration

Termwind Integration

Sinan includes Termwind for beautiful console output:

# Try the Termwind showcase
./sinan app:termwind-showcase

Configuration

Project-Level Configuration

Create a sinan.php or config/sinan.php file in your project root:

<?php
return [
    // Directory where new commands will be generated
    'command_directory' => __DIR__ . '/../app/Commands',

    // Namespace for generated commands
    'command_namespace' => 'App\\Commands',

    // Additional namespaces to register for command discovery
    'extra_command_namespaces' => [
        ['namespace' => 'App\\Commands', 'path' => __DIR__ . '/../app/Commands'],
        // Example: ['namespace' => 'Other\\Commands', 'path' => __DIR__ . '/../other/Commands'],
    ],
];
  • If omitted, Sinan defaults to src/Command and Scriptmancer\Sinan\Command for generation.
  • You can register multiple command packs by adding them to extra_command_namespaces.

Extending Sinan

Creating Custom Commands

Create a new command in the App\Commands namespace:

<?php

namespace App\Commands;

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
    name: 'app:custom-command',
    description: 'My custom command',
)]
class CustomCommand extends Command
{
    public function execute(InputInterface $input, OutputInterface $output): int
    {
        $output->writeln('<info>Hello from my custom command!</info>');
        return Command::SUCCESS;
    }
}

Using League/CLImate

Sinan CLI uses League/CLImate for beautiful, expressive CLI output.

Installation

CLImate is installed automatically as a dependency. No extra steps needed.

Example Usage

use League\CLImate\CLImate;

$climate = new CLImate();
$climate->bold()->backgroundBlue()->white()->out(' Sinan CLI ');
$climate->out('A modern, extensible CLI for the Nazım framework');
$climate->green('Version: v0.9.5');
$climate->yellow('Author: Gökhan SARIGÜL <gsarigul84@gmail.com>');
$climate->table([
    ['Feature' => 'Colors', 'Demo' => 'green, yellow, red, blue'],
    ['Feature' => 'Bold', 'Demo' => 'bold()'],
    ['Feature' => 'Backgrounds', 'Demo' => 'backgroundBlue()'],
    ['Feature' => 'Tables', 'Demo' => 'table()'],
]);

Showcase Command

Run the following to see a full demonstration of CLImate features:

./sinan climate:showcase

This will display colored messages, tables, progress bars, input prompts, and more.

See the League/CLImate documentation for all available features.

License

MIT

Author

Gökhan SARIGÜL gsarigul84@gmail.com

scriptmancer/sinan 适用场景与选型建议

scriptmancer/sinan 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 05 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 scriptmancer/sinan 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 scriptmancer/sinan 我们能提供哪些服务?
定制开发 / 二次开发

基于 scriptmancer/sinan 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-08