PHPackages                             allestuetsmerweh/php-typescript-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. allestuetsmerweh/php-typescript-api

ActiveLibrary[API Development](/categories/api)

allestuetsmerweh/php-typescript-api
===================================

Build a typed Web API using PHP and TypeScript

3.0.1(1mo ago)532.9k↑100%[3 issues](https://github.com/allestuetsmerweh/php-typescript-api/issues)MITPHPPHP &gt;=8.1CI passing

Since Oct 25Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/allestuetsmerweh/php-typescript-api)[ Packagist](https://packagist.org/packages/allestuetsmerweh/php-typescript-api)[ Docs](https://github.com/allestuetsmerweh/php-typescript-api)[ RSS](/packages/allestuetsmerweh-php-typescript-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (14)Versions (44)Used By (0)

php-typescript-api
==================

[](#php-typescript-api)

Build a typed Web API using PHP and TypeScript

**Disclaimer: This is not an officially supported Google product**

This project:

- helps with data validation on the server side by providing [fields](https://github.com/allestuetsmerweh/php-typescript-api/tree/main/server/lib/Fields/FieldTypes) or [phpstan](https://phpstan.org/writing-php-code/phpdoc-types) to define allowed request/response types.
- generates a typed API client in TypeScript.
- consists of a [server (PHP)](https://github.com/allestuetsmerweh/php-typescript-api/tree/main/server) library, a [client (TypeScript)](https://github.com/allestuetsmerweh/php-typescript-api/tree/main/client)library, and an [example](https://github.com/allestuetsmerweh/php-typescript-api/tree/main/example)of its usage.

Usage
-----

[](#usage)

### Server side (PHP)

[](#server-side-php)

- Install php-typescript-api using [composer](https://getcomposer.org/):

    `composer require allestuetsmerweh/php-typescript-api`
- Implement some endpoints for your API ([examples](https://github.com/allestuetsmerweh/php-typescript-api/tree/main/example/api/endpoints)).
- Define which endpoints your API contains ([example](https://github.com/allestuetsmerweh/php-typescript-api/blob/main/example/api/example_api.php)).
- Define how the TypeScript interface for your API should be generated ([example](https://github.com/allestuetsmerweh/php-typescript-api/blob/main/example/api/generate.php)).

    - Run that script in order to generate the TypeScript interface file: `php path/to/your/generate.php` ([example result](https://github.com/allestuetsmerweh/php-typescript-api/blob/main/example/web/ExampleApiTypes.ts))
    - You might want to run this script automatically when starting your local dev server, and check in your CI pipeline whether the committed TypeScript interface file is up-to-date.
- Have a publicly reachable PHP script that serves the API ([example](https://github.com/allestuetsmerweh/php-typescript-api/blob/main/example/web/example_api_server.php)).

### Client side (TypeScript)

[](#client-side-typescript)

- Install php-typescript-api using [npm](https://docs.npmjs.com/about-npm):

    `npm install --save php-typescript-api`
- Configure your API client ([example](https://github.com/allestuetsmerweh/php-typescript-api/blob/main/example/web/ExampleApi.ts)).
- Use your API client to make requests ([example](https://github.com/allestuetsmerweh/php-typescript-api/blob/main/example/web/index.ts)).

Contribute
----------

[](#contribute)

Build:

- Server: (no build necessary)
- Client: `npm run build`

Run tests:

- Server: `composer test`
- Client: `npm test`

Lint:

- Server: `composer fix`
- Client: `npm run lint`

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance77

Regular maintenance activity

Popularity32

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~41 days

Total

40

Last Release

56d ago

Major Versions

1.0.16 → 2.0.02022-08-29

1.0.17 → 2.0.32022-10-02

2.8.0 → 3.0.02026-03-23

PHP version history (2 changes)2.0.0PHP &gt;=8.1

2.5.0PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/a75abf5174d3271e28fd3effef0394b1396739198f53405952f523fe6dc301fc?d=identicon)[allestuetsmerweh](/maintainers/allestuetsmerweh)

---

Top Contributors

[![allestuetsmerweh](https://avatars.githubusercontent.com/u/12112442?v=4)](https://github.com/allestuetsmerweh "allestuetsmerweh (76 commits)")

---

Tags

phpapitypescript

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/allestuetsmerweh-php-typescript-api/health.svg)

```
[![Health](https://phpackages.com/badges/allestuetsmerweh-php-typescript-api/health.svg)](https://phpackages.com/packages/allestuetsmerweh-php-typescript-api)
```

###  Alternatives

[algolia/algoliasearch-client-php

API powering the features of Algolia.

69433.0M114](/packages/algolia-algoliasearch-client-php)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

553.3M7](/packages/checkout-checkout-sdk-php)[comgate/sdk

Comgate PHP SDK

13327.8k](/packages/comgate-sdk)[rubix/server

Deploy your Rubix ML models to production with scalable stand-alone inference servers.

632.3k](/packages/rubix-server)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
