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

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

[knplabs/knp-menu-bundle

This bundle provides an integration of the KnpMenu library

1.4k53.8M314](/packages/knplabs-knp-menu-bundle)[lipis/flag-icons

A curated collection of all country flags in SVG — plus the CSS for easier integration.

12.0k27.5k4](/packages/lipis-flag-icons)[graphp/graphviz

GraphViz graph drawing for the mathematical graph/network library GraPHP.

3232.1M49](/packages/graphp-graphviz)[davidpiesse/nova-map

Map field for Laravel Nova

114224.3k](/packages/davidpiesse-nova-map)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[php-mp4box/php-mp4box

PHP MP4Box, an Object Oriented library for easy file conversion with MP4 Box

16217.3k1](/packages/php-mp4box-php-mp4box)

PHPackages © 2026

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