https://github.com/hskrasek/arazzo-parser
Parse OpenAPI Arazzo specifications in PHP
https://github.com/hskrasek/arazzo-parser
arazzo arazzo-specification openapi
Last synced: 7 months ago
JSON representation
Parse OpenAPI Arazzo specifications in PHP
- Host: GitHub
- URL: https://github.com/hskrasek/arazzo-parser
- Owner: hskrasek
- License: agpl-3.0
- Created: 2025-03-09T20:07:47.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-03-16T17:52:02.000Z (7 months ago)
- Last Synced: 2025-03-18T02:57:42.033Z (7 months ago)
- Topics: arazzo, arazzo-specification, openapi
- Language: PHP
- Homepage:
- Size: 55.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# Parse Arazzo Specifications into PHP Objects
[](https://packagist.org/packages/hskrasek/arazzo-parser)
[](https://github.com/hskrasek/arazzo-parser/actions/workflows/run-tests.yml)
[](https://packagist.org/packages/hskrasek/arazzo-parser)This package allows you to parse [Arazzo Specifications][1] into plain old PHP objects.
```php
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:
```bash
composer require hskrasek/arazzo-parser
```## Usage
Your main and only entrypoint will be the Parser, which supports parsing an [Arazzo Specification][1] via many different methods and all standard formats.
```php
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
```bash
composer test
```## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [Hunter Skrasek](https://github.com/hskrasek)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
[1]: "Latest Arazzo Specification"