alexanderallen/panettone
Composer 安装命令:
composer require alexanderallen/panettone
包简介
A lightweight PHP type generator for Open API (formerly Swagger)
README 文档
README
Image by @blackieshoot at Unsplash
Panettone
Panettone is a CLI tool for extracting PHP types from Open API schemas. Types are generated by interpreting the data model (schema) of Open API documents. Unlike Api Platform's schema generator, it does not determine types using path and operations.
Update September 2024
- Work in progress for Use functional patterns when parsing Open API source
- Work in progress for 0.2.4
Update July 2024
Pre-release 0.2.3 introduces an initial set of functional structures to be used in the future for Open API parsing.
Installation
composer require alexanderallen/panettone
vendor/bin/panettone --help
As Panettone is not a CLI tool and not a library, I recommend that you install it to your project's tools directory, as such:
mkdir -p tools
cd tools
composer require alexanderallen/panettone
cd ..
vendor/bin/panettone --help
Example
vendor/bin/panettone schema/my-saucy-schema.yaml tmp vendor/alexanderallen/panettone/test/schema/settings.ini
In the example above, Panettone will:
- Source the
schema/my-saucy-schema.yamlOpen Api file; - Output all generated types to the
tmpdirectory, and; - Use the settings in
vendor/alexanderallen/panettone/test/schema/settings.inito guide the type generation process.
Usage
vendor/bin/panettone --help
Description:
Generate PHP types from Open API sources.
Usage:
panettone <input> [<output> [<config>]]
Arguments:
input Path to Open Api source file in YAML format
output Destination for generated files
config Path to .ini configuration file [default: "settings.ini"]
Options:
-h, --help Display help for the given command. When no command is given display help for the panettone command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
Generates PHP types from a Open API source.
Configuration
Panettone is configured by placing a settings.ini in the directory from where you are executing Panettone, usually where your composer.json is.
Below is a list of the currently supported configuration options. Do note that the [file], [class] segments
are required when using the options listed under them.
; Enable detailed logging during type generation.
debug = true
[file]
; Path where to dump the generated file.
output_path = "tmp"
; Namespace for all generated files.
namespace = "Panettone"
; Comment to apply to every generated file.
comment = "Example file comments are configured in settings.ini."
[class]
nullable = true
default = null
Testing
Tests are located in the tests directory. PHPUnit is installed separately in the tools/phpunit directory.
To test, first use Composer to install PHPUnit then run the test script.
composer -d tools/phpunit install
. tools/phpunit/test
Coverage
Coverage details are gathered during testing in Github and pushed to Coveralls.
alexanderallen/panettone 适用场景与选型建议
alexanderallen/panettone 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 03 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「schema」 「model」 「entity」 「dto」 「swagger」 「open api」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 alexanderallen/panettone 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 alexanderallen/panettone 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 alexanderallen/panettone 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Runn Me! Value Objects Library
Extension for Opis JSON Schema
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
EAV modeling package for Eloquent and Laravel.
serialize Symfony Forms into JSON schema
Interfaces for web resource models and services to retrieve and create them
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2024-03-30
