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

4.0.1(1mo ago)635.0k↑231.7%[2 issues](https://github.com/allestuetsmerweh/php-typescript-api/issues)MITPHPPHP &gt;=8.1CI failing

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 today

READMEChangelogDependencies (21)Versions (46)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

53

—

FairBetter than 96% of packages

Maintenance82

Actively maintained with recent releases

Popularity32

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity72

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 ~40 days

Recently: every ~22 days

Total

42

Last Release

53d 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

3.0.1 → 4.0.02026-05-11

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 (78 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

[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[symfony/http-kernel

Provides a structured process for converting a Request into a Response

8.1k869.4M8.8k](/packages/symfony-http-kernel)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69735.1M159](/packages/algolia-algoliasearch-client-php)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)

PHPackages © 2026

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