PHPackages                             illodev/api-platform-sdk-generator - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. illodev/api-platform-sdk-generator

ActiveSymfony-bundle[Validation &amp; Sanitization](/categories/validation)

illodev/api-platform-sdk-generator
==================================

Generate Zod schemas and typed HTTP repositories from your API Platform backend. Powered by Symfony Validator. Zero config.

v0.1.1(1mo ago)017MITPHPPHP &gt;=8.2CI passing

Since Apr 26Pushed 1mo agoCompare

[ Source](https://github.com/illodev/api-platform-sdk-generator)[ Packagist](https://packagist.org/packages/illodev/api-platform-sdk-generator)[ Docs](https://github.com/illodev/api-platform-sdk-generator)[ RSS](/packages/illodev-api-platform-sdk-generator/feed)WikiDiscussions main Synced 1w ago

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

api-platform-sdk-generator
==========================

[](#api-platform-sdk-generator)

Generate **Zod schemas** and **typed HTTP repositories** from your [API Platform](https://api-platform.com/) backend. One source of truth (Symfony Validator) → typed clients in your frontend. Zero config.

Why
---

[](#why)

You already define your domain in API Platform: `#[ApiResource]` for endpoints, `#[ApiProperty]` for visibility, `#[Assert\*]` for validation. That metadata is the single source of truth for what your API accepts and returns.

This bundle reads that metadata and generates a TypeScript SDK against it:

- **Zod schemas** (request + response) for full-stack validation.
- **Typed repositories** with HTTP CRUD methods, ready to plug into [TanStack Query](https://tanstack.com/query) or any data-fetching layer.
- **Resource keys** (constants) usable as query keys.
- **Enums** mirrored as TypeScript const objects.

No DTOs to keep in sync. No OpenAPI parser in the middle. No type loss at the boundary.

```
import { productRepository } from "@/sdk/repositories";
import type { ProductResponse } from "@/sdk/schemas";

const products = await productRepository.getCollection();
//    ^? GetCollectionResponse
```

Companion runtime — coming in v0.2.0
------------------------------------

[](#companion-runtime--coming-in-v020)

Generated repositories import from a thin runtime that defines `Repository`. **v0.1.0 ships the generator alone**: you provide the runtime (interface documented [below](#runtime-interface)).

**v0.2.0 will publish `@illodev/repository` to npm** — a fully typed, TanStack Query–powered runtime with `Repository`, `useGet`, `useGetCollection`, `useSuspenseGet`, `usePost`, `usePatch`, `useDelete`, sub-resource hooks, and more.

If you want to ship today, follow the runtime interface below. If you want to wait a week, the npm package lands soon.

Maintenance commitment
----------------------

[](#maintenance-commitment)

This bundle is extracted from [Fube](https://fube.es), a Spanish invoicing SaaS in production. We use it daily — bugs surface and get fixed under real-world load, not in isolation. As close to "battle-tested" as it gets without writing it yourself.

Requirements
------------

[](#requirements)

- PHP 8.2+
- Symfony 6.4+ (7.x supported)
- API Platform 4.0+

Install
-------

[](#install)

```
composer require --dev illodev/api-platform-sdk-generator
```

With [Symfony Flex](https://symfony.com/doc/current/setup/flex.html), the bundle is auto-registered and `config/packages/illodev_sdk.yaml` is created with sensible defaults. Manual registration:

```
// config/bundles.php
return [
    // ...
    Illodev\ApiPlatformSdkGenerator\IllodevSdkBundle::class => ['dev' => true, 'test' => true],
];
```

Usage
-----

[](#usage)

```
bin/console illodev:sdk:generate
```

Schemas, repositories, keys and enums are written to the configured output path (`%kernel.project_dir%/assets/sdk` by default).

### Configuration

[](#configuration)

```
# config/packages/illodev_sdk.yaml
illodev_sdk:
    output:
        path: '%kernel.project_dir%/assets/sdk'
        naming: PascalCase    # PascalCase | camelCase
    resources:
        include: ~            # null = all #[ApiResource] discovered
        exclude: []           # FQCN to exclude explicitly
```

What it generates
-----------------

[](#what-it-generates)

For each `#[ApiResource]`:

OutputPathDescriptionZod schemas`schemas/.ts``RequestSchema`, `ResponseSchema`, plus `z.infer` types.Repositories`repositories/.repository.ts``Repository = createRepository()`.Resource keys`schemas/keys.ts`String constants usable as query keys.Enums`schemas/enums/`TypeScript const objects mirroring PHP enums.Runtime interface
-----------------

[](#runtime-interface)

Until `@illodev/repository` lands in v0.2.0, generated repositories import `createRepository` and a `Repository` type from a path you control. Minimum interface:

```
export interface Repository {
  key: string;
  get(args: { identifier: string | number; uriTemplate?: string; request?: RequestInit; params?: SearchParams }): Promise;
  getCollection(args: { params?: SearchParams; request?: RequestInit }): Promise;
  post(args: { data: TInput; request?: RequestInit }): Promise;
  postMany(args: { data: TInput[]; request?: RequestInit }): Promise;
  patch(args: { identifier: string | number; data: Partial; request?: RequestInit }): Promise;
  patchMany(args: { identifiers: string[]; data: Partial; request?: RequestInit }): Promise;
  delete(args: { identifier: string | number; request?: RequestInit }): Promise;
  deleteMany(args: { identifiers: string[]; request?: RequestInit }): Promise;
  // sub-resources: getSubresource, getSubresourceCollection, postSubresource
}

export interface GetCollectionResponse {
  rows: T[];
  count: number;
}

export type SearchParams = Record;

export function createRepository(key: string): Repository;
```

Reference implementation will ship as `@illodev/repository` in v0.2.0.

Known limitations (v0.1.0)
--------------------------

[](#known-limitations-v010)

- **Serialization Groups (`#[Groups]`) are not supported.** Property visibility is derived exclusively from `#[ApiProperty(readable, writable)]`. If your project relies heavily on groups, this bundle is not yet a fit.
- **Nested `#[Assert\Collection]` and `#[Assert\All]`** for JSON columns may produce partial type extraction at deeper nesting levels. See [issues tagged `assert-nested`](https://github.com/illodev/api-platform-sdk-generator/issues?q=label%3Aassert-nested) for reproducible cases and workarounds.

Roadmap
-------

[](#roadmap)

- **v0.2.0** — `@illodev/repository` published to npm: full TanStack Query–powered runtime.
- **v0.3.0+** — driven by community feedback. Likely candidates: alternative schema libraries (Valibot, ArkType), Serialization Groups support if requested.

Contributing
------------

[](#contributing)

PRs welcome. Please open an issue first describing the change. See [CONTRIBUTING.md](CONTRIBUTING.md).

```
composer install
composer test        # PHPUnit
composer analyse     # PHPStan level 8
composer cs-check    # PHP-CS-Fixer dry-run
```

Sponsors
--------

[](#sponsors)

If this bundle saves you time, consider sponsoring via [GitHub Sponsors](https://github.com/sponsors/illodev) *(activated after v0.1.0)*.

License
-------

[](#license)

MIT © [Álvaro Jáuregui Pinto](https://illodev.com). See [LICENSE](LICENSE).

---

Built with care by [illodev](https://illodev.com).

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance91

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

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

Total

2

Last Release

44d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/894b56d207d5574ee46cd328696b60c95c3dfafad535385464b49db484abe55f?d=identicon)[illodev](/maintainers/illodev)

---

Top Contributors

[![illodev](https://avatars.githubusercontent.com/u/55558169?v=4)](https://github.com/illodev "illodev (2 commits)")

---

Tags

symfonyschemavalidationgeneratortypescriptSymfony Bundlecodegenzodapi-platform

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/illodev-api-platform-sdk-generator/health.svg)

```
[![Health](https://phpackages.com/badges/illodev-api-platform-sdk-generator/health.svg)](https://phpackages.com/packages/illodev-api-platform-sdk-generator)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M370](/packages/easycorp-easyadmin-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M195](/packages/sulu-sulu)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M506](/packages/shopware-core)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9017.2k55](/packages/open-dxp-opendxp)

PHPackages © 2026

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