hskrasek/arazzo-parser 问题修复 & 功能扩展

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

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

hskrasek/arazzo-parser

最新稳定版本:v0.1.2

Composer 安装命令:

composer require hskrasek/arazzo-parser

包简介

Parse Arazzo specifications into plain old PHP objects.

README 文档

README

Latest Version on Packagist Tests Total Downloads

This package allows you to parse Arazzo Specifications into plain old PHP objects.

use HSkrasek\Arazzo\Parser;

$specification = Parser::parse(
    file_get_contents('https://raw.githubusercontent.com/bump-sh-examples/train-travel-api/a97f549346f8cb44ec8d5e9d08cfe57b8b09cd6e/arazzo.yaml')
);

var_dump($specification);

//object(HSkrasek\Arazzo\Specification\Arazzo)#636 (5) {
//  ["arazzo"]=>
//  enum(HSkrasek\Arazzo\Specification\Version::V1_0_1)
//  ["info"]=>
//  object(HSkrasek\Arazzo\Specification\Info)#736 (4) {
//    ["title"]=>
//    string(30) "BNPL Loan Application Workflow"
//    ["version"]=>
//    string(5) "1.0.0"
//    ["summary"]=>
//    NULL
//    ["description"]=>
//    string(354) "This workflow walks through the steps to apply for a BNPL loan at checkout, including checking product eligibility, retrieving terms and conditions, creating a customer record, initiating the loan transaction, customer authentication, and retrieving the finalized payment plan. It concludes by updating the order status once the transaction is complete."
//  ...
//  }

Installation

You can install the package via composer:

composer require hskrasek/arazzo-parser

Usage

Your main and only entrypoint will be the Parser, which supports parsing an Arazzo Specification via many different methods and all standard formats.

use HSkrasek\Arazzo\Parser;

// Parse an Arazzo specification string
$specification = Parser::parse(
    file_get_contents('https://raw.githubusercontent.com/bump-sh-examples/train-travel-api/a97f549346f8cb44ec8d5e9d08cfe57b8b09cd6e/arazzo.yaml')
);
// or parse an Arazzo specification from a file
$specification = Parser::parse(new SplFileObject(__DIR__ . '/arazzo.yaml'));

// or parse an Arazzo specification from a resource handler

$specification = Parser::parse(fopen(__DIR__ . '/arazzo.yaml'));

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: AGPL-3.0-or-later
  • 更新时间: 2025-03-16