PHPackages                             mathsgod/graphqlite-mixed-type - 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. mathsgod/graphqlite-mixed-type

ActiveLibrary[API Development](/categories/api)

mathsgod/graphqlite-mixed-type
==============================

mixed type for graphqlite

2.3.1(4w ago)09.3k1MITPHPCI passing

Since Aug 24Pushed 4w ago1 watchersCompare

[ Source](https://github.com/mathsgod/graphqlite-mixed-type)[ Packagist](https://packagist.org/packages/mathsgod/graphqlite-mixed-type)[ RSS](/packages/mathsgod-graphqlite-mixed-type/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (6)Dependencies (3)Versions (7)Used By (1)

[![PHP Composer](https://github.com/mathsgod/graphqlite-mixed-type/actions/workflows/php.yml/badge.svg)](https://github.com/mathsgod/graphqlite-mixed-type/actions/workflows/php.yml)

graphqlite-mixed-type
=====================

[](#graphqlite-mixed-type)

`mixed` input and output type support for [thecodingmachine/graphqlite](https://github.com/thecodingmachine/graphqlite).

GraphQL does not natively support a `mixed` scalar type. This package adds a custom `mixed` scalar that can accept and return any value — objects, arrays, strings, numbers, or booleans — without requiring a predefined schema type.

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

[](#requirements)

- PHP 8.1+
- `thecodingmachine/graphqlite` ^8.1

Installation
------------

[](#installation)

```
composer require mathsgod/graphqlite-mixed-type
```

Setup
-----

[](#setup)

Register the mapper factory when building your schema:

```
use GQL\Type\MixedTypeMapperFactory;

$factory = new SchemaFactory($cache, $container);
// ...
$factory->addRootTypeMapperFactory(new MixedTypeMapperFactory());
```

Usage
-----

[](#usage)

### Output type

[](#output-type)

Use `outputType: "mixed"` on a `#[Query]` or `#[Mutation]` to return any value:

```
use TheCodingMachine\GraphQLite\Annotations\Query;

class Controllers
{
    /**
     * @param mixed $a
     */
    #[Query(outputType: "mixed")]
    public function mixedInput($a): mixed
    {
        return $a;
    }
}
```

### Input type

[](#input-type)

Annotate a parameter with `@param mixed` to accept any input value:

```
/**
 * @param mixed $data
 */
#[Query(outputType: "mixed")]
public function echo(mixed $data): mixed
{
    return $data;
}
```

### Example query

[](#example-query)

```
query {
    mixedInput(a: {hello: "world"})
}
```

Response:

```
{
  "data": {
    "mixedInput": {
      "hello": "world"
    }
  }
}
```

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

[](#how-it-works)

ClassRole`MixedType`Custom GraphQL scalar that passes any value through as-is`MixedTypeMapper`Maps PHP `mixed` type to/from `MixedType` for inputs and outputs`MixedTypeMapperFactory`Factory registered with `SchemaFactory` to plug in the mapperTesting
-------

[](#testing)

```
composer install
vendor/bin/phpunit
```

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance94

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

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

Recently: every ~406 days

Total

6

Last Release

28d ago

Major Versions

1.0.0 → 2.0.02021-12-10

### Community

Maintainers

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

---

Top Contributors

[![mathsgod](https://avatars.githubusercontent.com/u/18732337?v=4)](https://github.com/mathsgod "mathsgod (34 commits)")

---

Tags

graphqlphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mathsgod-graphqlite-mixed-type/health.svg)

```
[![Health](https://phpackages.com/badges/mathsgod-graphqlite-mixed-type/health.svg)](https://phpackages.com/packages/mathsgod-graphqlite-mixed-type)
```

###  Alternatives

[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[thecodingmachine/graphqlite-bundle

A Symfony bundle for thecodingmachine/graphqlite.

371.7M3](/packages/thecodingmachine-graphqlite-bundle)[oxid-esales/graphql-base

OXID eSales GraphQL base module

24105.3k16](/packages/oxid-esales-graphql-base)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93452.6k6](/packages/botman-driver-telegram)[thecodingmachine/graphqlite-laravel

A Laravel service provider package to help you get started with GraphQLite in Laravel.

1854.1k1](/packages/thecodingmachine-graphqlite-laravel)

PHPackages © 2026

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