PHPackages                             worksome/graphql-helpers - 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. worksome/graphql-helpers

ActiveLibrary[API Development](/categories/api)

worksome/graphql-helpers
========================

This is my package graphql-helpers

v0.1.18(2mo ago)2282.6k↑17.9%[1 PRs](https://github.com/worksome/graphql-helpers/pulls)1MITPHPPHP ^8.4CI passing

Since Feb 10Pushed 1mo ago10 watchersCompare

[ Source](https://github.com/worksome/graphql-helpers)[ Packagist](https://packagist.org/packages/worksome/graphql-helpers)[ Docs](https://github.com/worksome/graphql-helpers)[ GitHub Sponsors](https://github.com/worksome)[ RSS](/packages/worksome-graphql-helpers/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (18)Versions (26)Used By (1)

PHP GraphQL Helpers
===================

[](#php-graphql-helpers)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f0676cf94f36f9dcbccb6e1426d6a5d3989e461e99610db0530142b91db30879/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f776f726b736f6d652f6772617068716c2d68656c706572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/worksome/graphql-helpers)[![GitHub Tests Action Status](https://camo.githubusercontent.com/068fbb4370bc08bcd56f8ca555f5c3945383705065d5d3d690d1a81b0a9b01b7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f776f726b736f6d652f6772617068716c2d68656c706572732f74657374732e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265266c6162656c3d5465737473)](https://github.com/worksome/graphql-helpers/actions?query=workflow%3ATests+branch%3Amain)[![GitHub Static Analysis Action Status](https://camo.githubusercontent.com/5f543c86f445fc43b77d1f74358d70feaa918503d36da9acae26fe567e522c4d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f776f726b736f6d652f6772617068716c2d68656c706572732f7374617469632e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265266c6162656c3d537461746963253230416e616c79736973)](https://github.com/worksome/graphql-helpers/actions?query=workflow%3A%22Static%20Analysis%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/5084ee8d2baa5f4c35d7b14c38016a43123e7c448dae8dd45c50186393af2a59/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f776f726b736f6d652f6772617068716c2d68656c706572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/worksome/graphql-helpers)

A collection of GraphQL helpers for [GraphQL PHP](https://github.com/webonyx/graphql-php).

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

[](#installation)

You can install the package via composer:

```
composer require worksome/graphql-helpers
```

Usage
-----

[](#usage)

### Enum Type Registration

[](#enum-type-registration)

The [`PhpEnumType`](src/Definition/PhpEnumType.php) class can be used to override the `GraphQL\Type\Definition\EnumType` class with automatic case conversion.

```
enum MyEnum
{
    case CaseOne;
}

new \Worksome\GraphQLHelpers\Definition\PhpEnumType(MyEnum::class);
```

The `PhpEnumType` class will automatically use the description from the `GraphQL\Type\Definition\Description`attribute if it is present.

#### The `CasesDescribedBy` attribute

[](#the-casesdescribedby-attribute)

If you require the use of a custom method to retrieve the description, you can use the `#[CasesDescribedBy]` attribute.

```
#[\Worksome\GraphQLHelpers\Definition\Attributes\CasesDescribedBy(describer: 'description')]
enum MyEnum
{
    case CaseOne;

    public function description(): string
    {
        return 'The First Case!';
    }
}
```

### Enum Concerns

[](#enum-concerns)

#### `GraphQLConvertable`

[](#graphqlconvertable)

The [`GraphQLConvertable` concern](src/Definition/Concerns/GraphQLConvertable.php) is used to easily convert an enum instance to its GraphQL value within your codebase.

```
enum MyEnum
{
    use \Worksome\GraphQLHelpers\Definition\Concerns\GraphQLConvertable;

    case CaseOne;
}

MyEnum::CaseOne->toGraphQLValue(); // CASE_ONE
```

#### `GraphQLDescribable`

[](#graphqldescribable)

The [`GraphQLDescribable` concern](src/Definition/Concerns/GraphQLDescribable.php) is used to easily retrieve the description of an enum instance using the value from a `GraphQL\Type\Definition\Description` attribute.

```
enum MyEnum
{
    use \Worksome\GraphQLHelpers\Definition\Concerns\GraphQLDescribable;

    #[\GraphQL\Type\Definition\Description('The First Case!')]
    case CaseOne;
}

MyEnum::CaseOne->description(); // The First Case!
```

### Testing Enums

[](#testing-enums)

The [`HandlesEnumConversions` concern](src/Testing/Concerns/HandlesEnumConversions.php) adds support for quickly converting an enum to its GraphQL value.

```
enum MyEnum
{
    case CaseOne;
}

// In Pest
uses(\Worksome\GraphQLHelpers\Testing\Concerns\HandlesEnumConversions::class);

$this->enumToGraphQL(MyEnum::CaseOne); // CASE_ONE
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [GitHub Releases](https://github.com/worksome/graphql-helpers/releases) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Owen Voke](https://github.com/worksome)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance87

Actively maintained with recent releases

Popularity37

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 83.6% 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 ~61 days

Total

19

Last Release

80d ago

PHP version history (3 changes)v0.1.0PHP ^8.2

v0.1.13PHP ^8.3

v0.1.17PHP ^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1899334?v=4)[Owen Voke](/maintainers/owenvoke)[@owenvoke](https://github.com/owenvoke)

---

Top Contributors

[![owenvoke](https://avatars.githubusercontent.com/u/1899334?v=4)](https://github.com/owenvoke "owenvoke (46 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![alberthaff](https://avatars.githubusercontent.com/u/3864165?v=4)](https://github.com/alberthaff "alberthaff (2 commits)")[![lukeraymonddowning](https://avatars.githubusercontent.com/u/12202279?v=4)](https://github.com/lukeraymonddowning "lukeraymonddowning (2 commits)")

---

Tags

laravelworksomegraphql-helpers

###  Code Quality

TestsPest

Static AnalysisPHPStan

### Embed Badge

![Health badge](/badges/worksome-graphql-helpers/health.svg)

```
[![Health](https://phpackages.com/badges/worksome-graphql-helpers/health.svg)](https://phpackages.com/packages/worksome-graphql-helpers)
```

###  Alternatives

[nuwave/lighthouse

A framework for serving GraphQL from Laravel

3.5k10.7M93](/packages/nuwave-lighthouse)[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k586.2k3](/packages/andreaselia-laravel-api-to-postman)[mollie/laravel-mollie

Mollie API client wrapper for Laravel &amp; Mollie Connect provider for Laravel Socialite

3624.1M28](/packages/mollie-laravel-mollie)[api-ecosystem-for-laravel/dingo-api

A RESTful API package for the Laravel and Lumen frameworks.

3121.5M10](/packages/api-ecosystem-for-laravel-dingo-api)[essa/api-tool-kit

set of tools to build an api with laravel

52680.5k](/packages/essa-api-tool-kit)[mll-lab/laravel-graphiql

Easily integrate GraphiQL into your Laravel project

683.2M9](/packages/mll-lab-laravel-graphiql)

PHPackages © 2026

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