PHPackages                             psx/api - 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. [API Development](/categories/api)
4. /
5. psx/api

ActiveLibrary[API Development](/categories/api)

psx/api
=======

Parse and generate API specification formats

v7.5.1(2mo ago)37178.0k—0.9%94Apache-2.0PHPPHP &gt;=8.1CI passing

Since Apr 2Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/apioo/psx-api)[ Packagist](https://packagist.org/packages/psx/api)[ Docs](https://phpsx.org)[ Fund](https://www.paypal.me/fusioapi)[ GitHub Sponsors](https://github.com/chriskapp)[ RSS](/packages/psx-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (12)Versions (203)Used By (4)

API
===

[](#api)

This library provides an attribute parser to dynamically generate a [TypeAPI](https://typeapi.org/) specification from any controller (code-first). Based on the specification it is then possible to generate client SDKs or an OpenAPI specification.

We provide also a hosted version of this [code generator](https://typeapi.org/generator). For more integration options you can also take a look at the [SDKgen](https://sdkgen.app/) project which provides a CLI binary or GitHub action to integrate the code generator.

Usage
-----

[](#usage)

The root model object is called a `Specification` which contains `Operations` and `Definitions`. Each operation maps to a specific REST API endpoint and the definitions represent the schemas to describe the JSON request or response payload.

### Framework

[](#framework)

You can use PHP attributes to describe the structure of your endpoints. You can then use the attribute parser (`PSX\Api\Parser\Attribute`) to automatically generate a specification for your controller. A controller class could then look like:

```
