Parse and generate API specification formats



This library provides model classes to describe your API. Based on those models it is possible to generate i.e. API specification formats like OpenAPI and also client code which can be used at an SDK. It is also possible to generate those model classes either via annotations or from an OpenAPI specification. We have also created an online tool to test those conversions.



  • Go (in development)
  • Java (in development)
  • PHP (stable)
  • Typescript (stable)


  • HTML
  • Markdown



The root model object is called Resource which represents a specific API endpoint. The following is a simple showcase of the resource API so you get a basic understanding how it is designed.


// reads the OpenAPI specification and generates a resource object which was
// defined under the path /foo
$resource = \PSX\Api\Parser\OpenAPI::fromFile('openapi.json', '/foo');

// returns the title

// returns available path parameters as PSX\Schema\PropertyInterface

// checks whether a specific request method is supported

// returns all allowed methods

// returns the available query parameters per method as PSX\Schema\PropertyInterface

// checks whether the method has a request specification

// returns the request body specification as PSX\Schema\SchemaInterface

// checks whether the method has a response with the status code 201

// returns the response body specification as PSX\Schema\SchemaInterface

// creates a PHP client which consumes the defined /foo resource
$generator = new \PSX\Api\Generator\Client\Php();

$source = $generator->generate($resource);