PHPackages                             toppynl/api-platform-federation - 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. toppynl/api-platform-federation

ActiveSymfony-bundle[API Development](/categories/api)

toppynl/api-platform-federation
===============================

GraphQL Federation v2 bridge for API Platform v3 (Symfony bundle)

v0.2.1(2w ago)05↓100%MITPHPPHP &gt;=8.1CI failing

Since May 1Pushed 2w agoCompare

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

READMEChangelogDependencies (5)Versions (4)Used By (0)

toppynl/api-platform-federation
===============================

[](#toppynlapi-platform-federation)

GraphQL Federation v2 bridge for API Platform v3 — as a Symfony bundle.

[![CI](https://github.com/toppynl/api-platform-federation/actions/workflows/ci.yml/badge.svg)](https://github.com/toppynl/api-platform-federation/actions/workflows/ci.yml)

What it does
------------

[](#what-it-does)

This zero-config Symfony bundle decorates API Platform's `SchemaBuilderInterface` to inject Federation v2 infrastructure (`_service`, `_entities`, `@key` directives) into the composed GraphQL schema. Mark any API Platform resource as a federation entity with a single `#[FederationKey]` attribute — no YAML, no XML, no extra wiring required. Reference resolution delegates to API Platform's own state providers by default, and can be overridden per type.

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

[](#requirements)

DependencyVersionPHP`^8.1``api-platform/core``^3.0``symfony/framework-bundle``^6.4 || ^7.0``toppynl/graphql-federation``^1.0`Installation
------------

[](#installation)

```
composer require toppynl/api-platform-federation
```

Register the bundle in `config/bundles.php`:

```
Toppynl\ApiPlatformFederation\ToppynlApiPlatformFederationBundle::class => ['all' => true],
```

Quick start
-----------

[](#quick-start)

```
use ApiPlatform\Metadata\ApiResource;
use Toppynl\ApiPlatformFederation\Attribute\FederationKey;

#[ApiResource]
#[FederationKey(fields: 'id')]
class Product
{
    public string $id;
    public string $name;
}
```

That's it — `_service`, `_entities`, and `@key(fields: "id")` in the SDL are injected automatically.

Available attributes
--------------------

[](#available-attributes)

AttributeApplies toPurpose`#[FederationKey(fields: 'id')]`classMark as resolvable entity key`#[FederationKey(fields: 'id', resolvable: false)]`classReference-only stub (no resolver registered)`#[FederationExternal]`class / propertyMark as externally owned`#[FederationShareable]`class / propertyAllow field sharing across subgraphs`#[FederationInaccessible]`class / propertyHide from composed schema`#[FederationOverride(from: 'other-subgraph')]`propertyOverride field from another subgraphMultiple keys
-------------

[](#multiple-keys)

A type can expose more than one key field set by stacking `#[FederationKey]` — all instances must agree on `resolvable`:

```
#[ApiResource]
#[FederationKey(fields: 'id')]
#[FederationKey(fields: 'sku')]
class Product
{
    public string $id;
    public string $sku;
    public string $name;
}
```

Both keys are registered; the gateway may use either to resolve a `Product` reference.

Custom reference resolvers
--------------------------

[](#custom-reference-resolvers)

By default the bundle resolves `_entities` lookups through API Platform's state provider. To override this for a specific type, pre-register a callable in `ReferenceResolverRegistry` before the schema is built — the loader skips types that already have a resolver:

```
use Toppynl\GraphQLFederation\ReferenceResolverRegistry;

class ProductReferenceResolverRegistrar
{
    public function __construct(private ReferenceResolverRegistry $registry) {}

    public function boot(): void
    {
        $this->registry->register('Product', function (array $rep): mixed {
            return $this->productRepo->findBySku($rep['sku']);
        });
    }
}
```

How it works
------------

[](#how-it-works)

- `FederatedSchemaBuilderDecorator` wraps API Platform's `SchemaBuilderInterface`, calls the inner builder to obtain the base schema, then hands it off to `FederatedSchemaBuilder` from `toppynl/graphql-federation`.
- `AttributeReferenceResolverLoader` reads `#[FederationKey]` attributes via reflection on each mapped resource class, collecting key field sets and the shared `resolvable` flag.
- `FederatedSchemaBuilder` (core library) splices `_service`, `_entities`, and all `@key` / `@external` / `@shareable` / `@inaccessible` / `@override` directives into the final schema. See [toppynl/graphql-federation](https://github.com/toppynl/graphql-federation) for the underlying mechanics.

License
-------

[](#license)

MIT

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance96

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 90.9% 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 ~10 days

Total

3

Last Release

19d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/239d9adcbadfaac1e3ce531c1b81d87e378c3395b9c10bef5bfddb1637c07c9d?d=identicon)[Swahjak](/maintainers/Swahjak)

---

Top Contributors

[![Swahjak](https://avatars.githubusercontent.com/u/4386577?v=4)](https://github.com/Swahjak "Swahjak (10 commits)")[![herman-aka-wouter](https://avatars.githubusercontent.com/u/40226924?v=4)](https://github.com/herman-aka-wouter "herman-aka-wouter (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/toppynl-api-platform-federation/health.svg)

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.8M710](/packages/sylius-sylius)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.1k16.8k](/packages/prestashop-prestashop)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1155.2k](/packages/rcsofttech-audit-trail-bundle)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1715.6k12](/packages/2lenet-crudit-bundle)

PHPackages © 2026

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