PHPackages                             baraja-core/entity-to-typescript - 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. baraja-core/entity-to-typescript

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

baraja-core/entity-to-typescript
================================

Convert any PHP entity to TypeScript.

v1.0.1(3y ago)357PHPPHP ^8.0

Since Nov 16Pushed 3y ago1 watchersCompare

[ Source](https://github.com/baraja-core/entity-to-typescript)[ Packagist](https://packagist.org/packages/baraja-core/entity-to-typescript)[ Docs](https://github.com/baraja-core/entity-to-typescript)[ RSS](/packages/baraja-core-entity-to-typescript/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (3)Used By (0)

PHP Entity to TypeScript Transpiler
===================================

[](#php-entity-to-typescript-transpiler)

Tool for simple conversion of PHP model entities to TypeScript.

- No Composer package dependencies
- Native support for PHP property types and annotations
- Analyze dependent entities recursively including arrays
- Native support for TypeScript Record like `Record;`
- Unique interface names when scanning multiple entities

How to use
----------

[](#how-to-use)

```
// create service instance (no dependency needed!)
$service = new EntityToTypescript();

// analyze your service and write dependencies to bag
$bag = new DependencyBag();
$bag = $service->process(SampleEntity::class, $bag);

// render TypeScript to string
echo $service->render($bag);
```

The principle of storing dependencies in Badge
----------------------------------------------

[](#the-principle-of-storing-dependencies-in-badge)

When scanning a passed PHP entity, dependent entities are also recursively scanned, including annotations and compound types such as PHP arrays. Information about all scanned entities is stored in a common location in a so-called `Badge`, which ensures that the names of all generated interfaces are unique.

If you need to generate TypeScript definitions for a group of multiple entities, or an entire project, simply pass the same Badge instance to multiple generations.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.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 ~97 days

Total

2

Last Release

1176d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3382204?v=4)[baraja](/maintainers/baraja)[@baraja](https://github.com/baraja)

---

Top Contributors

[![janbarasek](https://avatars.githubusercontent.com/u/4738758?v=4)](https://github.com/janbarasek "janbarasek (6 commits)")[![flokixdev](https://avatars.githubusercontent.com/u/2387790?v=4)](https://github.com/flokixdev "flokixdev (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/baraja-core-entity-to-typescript/health.svg)

```
[![Health](https://phpackages.com/badges/baraja-core-entity-to-typescript/health.svg)](https://phpackages.com/packages/baraja-core-entity-to-typescript)
```

###  Alternatives

[velhron/dadata-bundle

DaData for Symfony

2076.6k](/packages/velhron-dadata-bundle)[phpcfdi/xml-cancelacion

Genera documentos de cancelación de CFDI firmados (XMLSEC)

1149.5k4](/packages/phpcfdi-xml-cancelacion)[pressbooks/pressbooks-aldine

Aldine is the default theme for the home page of Pressbooks networks. It is named for the Aldine Press, founded by Aldus Manutius in 1494, who is regarded by many as the world’s first publisher.

114.3k](/packages/pressbooks-pressbooks-aldine)

PHPackages © 2026

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