PHPackages                             snakedove/php-to-typescript-converter - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. snakedove/php-to-typescript-converter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

snakedove/php-to-typescript-converter
=====================================

Converts POPOs to Typescript interfaces.

3.1.0(5y ago)72.2k2[1 PRs](https://github.com/snakedove/php-to-typescript-converter/pulls)MITPHPPHP ^7.4 || ^8.0CI passing

Since Apr 13Pushed 3mo ago4 watchersCompare

[ Source](https://github.com/snakedove/php-to-typescript-converter)[ Packagist](https://packagist.org/packages/snakedove/php-to-typescript-converter)[ RSS](/packages/snakedove-php-to-typescript-converter/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (2)Versions (19)Used By (0)

README
======

[](#readme)

Thanks for using `snakedove/php-to-typescript-converter`!

### What is this repository for?

[](#what-is-this-repository-for)

- Adds a command to your symfony project with which you can convert plain old php objects e.g. DTOs to TypeScript Interfaces.

### Usage

[](#usage)

`bin/console ts-create  ` creates a Typescript Interface.d.ts file for a given source .php file.

`bin/console ts-create-all  ` creates Typescript Interface files for all source .php files contained in the given directory and its sub-directories, recursively.

- Nullable types will not convert to `type | null` because all types are nullable by default in TypeScript.

### Prerequisites

[](#prerequisites)

- Works for PHP 7.4 POPOs only
- Works from Symfony 4

### Configuration

[](#configuration)

- add one or both of the following configuration to your `services.yaml`:

```
Snakedove\PHPToTypescriptConverter\Command\PhpToTypescriptCommand:
    tags: ['console.command']

```

- Now, the command `ts-create` should show up when using `bin/console list`.

```
Snakedove\PHPToTypescriptConverter\Command\PhpToTypescriptAllCommand:
    tags: ['console.command']

```

- Now, the command `ts-create-all` should show up when using `bin/console list`.

Optional:

- pass argument `$nameSuffix` to the command, e.g. 'Interface'. This will add 'Interface' to all file and interface names.
- pass argument `$convertCollection` to the command. Set to false, this will include the collection as an own InterfaceType. Per default, collections will be converted to `CollectionType[]`, and Collection classes will not be converted.

Example configuration

```
Snakedove\PHPToTypescriptConverter\Command\PhpToTypescriptCommand:
    tags: ['console.command']
    arguments:
        $nameSuffix: Interface
        $convertCollections: true

```

### Caveats

[](#caveats)

- Does currently not support fluent interfaces

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance54

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 65.7% 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 ~22 days

Recently: every ~81 days

Total

16

Last Release

1889d ago

Major Versions

1.1.0 → 2.0.02020-04-14

2.1.6 → 3.0.02020-04-16

PHP version history (2 changes)1.0.0PHP ^7.4

3.1.0PHP ^7.4 || ^8.0

### Community

Maintainers

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

---

Top Contributors

[![snakedove](https://avatars.githubusercontent.com/u/10175045?v=4)](https://github.com/snakedove "snakedove (23 commits)")[![hbauho](https://avatars.githubusercontent.com/u/63708196?v=4)](https://github.com/hbauho "hbauho (11 commits)")[![MrRocko](https://avatars.githubusercontent.com/u/11043828?v=4)](https://github.com/MrRocko "MrRocko (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/snakedove-php-to-typescript-converter/health.svg)

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

###  Alternatives

[mirazmac/dotenvwriter

A PHP library to write values to .env (DotEnv) files

19129.3k7](/packages/mirazmac-dotenvwriter)[joegreen0991/config

Config component based on laravel's

233.3k](/packages/joegreen0991-config)

PHPackages © 2026

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