PHPackages                             machatschek/saloon-sdk-generator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. machatschek/saloon-sdk-generator

ActiveProject

machatschek/saloon-sdk-generator
================================

Simplified SDK Scaffolding for Saloon

v1.5.10(1mo ago)036MITPHPPHP ^8.2

Since Jan 5Pushed 1mo agoCompare

[ Source](https://github.com/mmachatschek/saloon-sdk-generator)[ Packagist](https://packagist.org/packages/machatschek/saloon-sdk-generator)[ RSS](/packages/machatschek-saloon-sdk-generator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (24)Versions (22)Used By (0)

Atention
--------

[](#atention)

This is a fork of [crescat-io/saloon-sdk-generator](https://github.com/crescat-io/saloon-sdk-generator). The fork adds some additional Bugfixes + Support for OpenAPI V3.1 specs.

[![](.github/header.png)](.github/header.png)

Saloon SDK Generator - Simplified SDK Scaffolding 🚀
===================================================

[](#saloon-sdk-generator---simplified-sdk-scaffolding-)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9a2dd31c343d8b23d888c0473f4ccb41743baf0bedc287c53d48d8192fa911ba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6163686174736368656b2f73616c6f6f6e2d73646b2d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/machatschek/saloon-sdk-generator)[![Total Downloads](https://camo.githubusercontent.com/7765b858cbdd367be078a3094945725cbc8ba9e7211c5113db5b91b6bb83fb41/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6163686174736368656b2f73616c6f6f6e2d73646b2d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/machatschek/saloon-sdk-generator)

Introducing the Saloon SDK Generator – your tool for quickly creating the basic structure of PHP SDKs using the powerful [Saloon](https://docs.saloon.dev/) package.

Please note: This tool helps you set up the foundation for your SDK, but it might not create a complete, ready-to-use solution. 🛠️

Whether you're using Postman Collection JSON files (v2.1) or OpenAPI specifications, the Saloon SDK Generator simplifies the process of generating PHP SDKs. It provides you with a starting point to build the initial framework for your API interactions.

Keep in mind that the generated code might not be perfect for every situation. Think of it as a speedy way to scaffold your SDK structure. While you might need to customize it for specific cases, the Saloon SDK Generator saves you time by eliminating the need to create boilerplate code from scratch.

Your journey to crafting a tailored SDK starts here – with the Saloon SDK Generator. 🌟

Installation
------------

[](#installation)

You can install this package using Composer:

```
composer global require machatschek/saloon-sdk-generator
```

Usage
-----

[](#usage)

### Generate SDK from OpenAPI or Postman Collection

[](#generate-sdk-from-openapi-or-postman-collection)

To generate the PHP SDK from an API specification file, run the following command:

```
sdkgenerator generate:sdk API_SPEC_FILE.{json|yaml|yml}
     --type={postman|openapi}
    [--name=SDK_NAME]
    [--output=OUTPUT_PATH]
    [--namespace=Company\\Integration]
    [--force]
    [--dry]
    [--zip]
```

Replace the placeholders with the appropriate values:

- `API_SPEC_FILE`: Path to the API specification file (JSON or YAML format).
- `--type`: Specify the type of API specification (`postman` or `openapi`).
- `--name`: (Optional) Specify the name of the generated SDK (default: Unnamed).
- `--namespace`: (Optional) Specify the root namespace for the SDK (default: `App\\Sdk`).
- `--output`: (Optional) Specify the output path where the generated code will be created (default: ./Generated).
- `--force`: (Optional) Force overwriting existing files.
- `--dry`: (Optional) Perform a dry run. It will not save generated files, only show a list of them.
- `--zip`: (Optional) Use this flag to generate a zip archive containing all the generated files.

**Note:** Due to PHP using Backslashes `\`, when specifying the `--namespace`, you need to escape any backslashes like so:

```
sdkgenerator generate:sdk ./tests/Samples/paddle.json
  --force
  --type=postman
  --name=Paddle
  --output ./paddle-sdk/src
  --namespace=Your\\Sdk\\Namespace #
