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()raisesRuntimeExceptionif a target exists. - Templates are inline strings, not external files. Keeps the scaffolder dependency-free (only Symfony Console).
Adding a new make:*
- Create
src/Maker/<Name>.phpextendingSymfony\Component\Console\Command\Commandand implementingSpora\Maker\MakerInterface. - Implement
generate(InputInterface, OutputInterface, Generator): void. Use$generator->generateFile('relative/path.php', $contents)to queue. - Append the class FQCN to
MakeCommand::MAKERS.
That's it — no other wiring required.
License
MIT.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-01