定制 spora-ai/spora-maker 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

spora-ai/spora-maker

Composer 安装命令:

composer require spora-ai/spora-maker

包简介

Scaffolder for the Spora project App — generates Tools, Controllers, and the App.php entry class. Inspired by Symfony's MakerBundle. Install as a require-dev dep.

README 文档

README

Scaffolder for the Spora project App — generates Tools, Controllers, and the app/App.php entry class. Inspired by Symfony's maker-bundle, scoped to the project-local extension model introduced in Spora v0.5.

Install

composer require-dev spora-ai/spora-maker

The skeleton already wires this up — composer.json lists spora-ai/spora-maker in require-dev. The path repository in the skeleton points at this repo locally; in production it will resolve from Packagist once published.

Commands

All commands assume the project root as the working directory (matching bin/spora's convention).

make:tool <Name>

php bin/spora make:tool WebSearch

Creates app/Tools/WebSearchTool.php using the AbstractTool + #[Tool] attribute pattern from spora-core. Refuses to overwrite an existing file.

make:controller <Name>

php bin/spora make:controller MyApi

Creates app/Http/Controllers/MyApiController.php with a placeholder index() method returning a JSON response, and prints the route-registration snippet to paste into app/App.php inside routes(MiddlewareRouteCollector $r).

make:app

php bin/spora make:app

Recreates app/App.php from the latest scaffold template. Useful when the file was deleted and the developer wants a fresh reference.

Conventions

  • Project-relative paths (app/Tools/Foo.php, never absolute).
  • No overwrites — FileManager::dumpFile() raises RuntimeException if a target exists.
  • Templates are inline strings, not external files. Keeps the scaffolder dependency-free (only Symfony Console).

Adding a new make:*

  1. Create src/Maker/<Name>.php extending Symfony\Component\Console\Command\Command and implementing Spora\Maker\MakerInterface.
  2. Implement generate(InputInterface, OutputInterface, Generator): void. Use $generator->generateFile('relative/path.php', $contents) to queue.
  3. Append the class FQCN to MakeCommand::MAKERS.

That's it — no other wiring required.

License

MIT.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固