PHPackages                             radic/graphql\_streams\_api-module - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. radic/graphql\_streams\_api-module

ActiveStreams-addon[HTTP &amp; Networking](/categories/http)

radic/graphql\_streams\_api-module
==================================

Effortlessly bind your PyroCMS Streams to the GraphQL API service. A great alternative to the non-free pro api-module addon.

0.3.0(7y ago)521MITPHP

Since Oct 11Pushed 7y ago1 watchersCompare

[ Source](https://github.com/RobinRadic/graphql-streams-api)[ Packagist](https://packagist.org/packages/radic/graphql_streams_api-module)[ Docs](https://github.com/robinradic/graphql-streams-api)[ RSS](/packages/radic-graphql-streams-api-module/feed)WikiDiscussions master Synced 5d ago

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

PyroCMS GraphQL Streams Api Module
==================================

[](#pyrocms-graphql-streams-api-module)

- [Introduction](#introduction)
- [Preview](#preview)
- [Documentation](#documentation)
    - [Installation](#installation)
    - [Customization](#customization)
    - [Generate](#generate)
- [License](#license)

Introduction
------------

[](#introduction)

This module aims to provide an easy yet flexiable way to bind your PyroCMS Streams to a GraphQL API. This module integrates `nuwave/lighthouse` with PyroCMS Streams.

Please make sure you have a basic understanding of:

- [GraphQL](https://graphql.org/learn/)
- [webonyx/graphql-php](http://webonyx.github.io/graphql-php/getting-started/)
- [Lighthouse](https://lighthouse-php.netlify.com)

Preview
-------

[](#preview)

A small usage preview of this module.

### 1. Configure the bindings

[](#1-configure-the-bindings)

**config.php**

```
return [
    // other config options redacted, check out the documentation for a full overview
    'default_field_resolutions' => [
        'anomaly.field_type.addon'       => 'String',
        'anomaly.field_type.blocks'      => 'String',
        'anomaly.field_type.boolean'     => 'Boolean',
        'anomaly.field_type.checkboxes'  => 'Boolean',
        'anomaly.field_type.colorpicker' => 'String',
        //etc...
    ],
    'stream_bindings'           => [
        // namespace::slug
        'users::users'                 => [

            // generator results: type User {}
            'type_name'   => 'User',

            // PyroCMS Stream field assignment => GraphQL field type
            'resolutions' => [
                // custom type resolutions
                'id'         => 'ID',
                'roles'      => '[UserRole!] @hasMany',
                'created_at' => 'Date',
                'updated_at' => 'Date',
                'deleted_at' => 'Date',

                // The fields below will be resolved using the `default_field_resolutions`
                // If you want, you can assign a custom type resolutions like above
                'username',
                'display_name',
                'first_name',

                // protect fields by requiring authentication and permissions
                'email' => 'String @role(roles: ["admin"], operator: "AND")',
                'email' => 'String @role(roles: ["user", "guest"], operator: "NOT")',
                'email' => 'String @role(roles: ["admin", "user"], operator: "OR")',
                'last_name',
                'activated',
                'enabled',
            ],
        ],
        // other streams...
    ]
];
```

### 2. Generate the schema.graphql

[](#2-generate-the-schemagraphql)

When you have defined all stream bindings and resolutions to your liking then you need to run the generator. This will generate a GraphQL schema definition file that will be used by Lighthouse:

```
php artisan api:generate

```

### 3. And voila!

[](#3-and-voila)

[![GraphQL Query and Result](https://github.com/RobinRadic/graphql-streams-api/raw/master/screenshot.png)](https://github.com/RobinRadic/graphql-streams-api/raw/master/screenshot.png)

Documentation
-------------

[](#documentation)

### Installation

[](#installation)

**Add to composer**

```
composer require radic/graphql_streams_api-module

```

**Install addon**

```
php artisan addon:install radic.module.graphql_streams_api

```

**Publish the addon**

To customize and define your GraphQL service use the `api:publish` command.

This will publish the configuration and schema files to `resources/{application}/addons/radic/graphql_streams_api`.

```
php artisan api:publish

```

### Customization

[](#customization)

You can customize/define the GraphQL service in `resources/{application}/addons/radic/graphql_streams_api`:

- `config/config.php`
- `schema/queryable.graphqls`
- `schema/core.graphqls`

#### config.schema

[](#configschema)

- `output` : The path where the schema will be generated.
- `imports` : Paths to other schema definition files that will be included in the generated schema output.

#### config.stream\_bindings

[](#configstream_bindings)

This defines the streams that you want to be generated as GraphQL types.

```
'stream_bindings' => [
    // '{namespace}::{slug}'
    'users::users' => [
        'type_name'   => 'User', // The resulting GraphQL schema type name.
        'resolutions' => [
            'slug',
            'title',
            'roles' => '[UserRole!] @hasMany',
        ]
    ],
    'users::roles' => [
        'type_name'   => 'UserRole',
        'resolutions' => [
            'slug'
        ]
    ]
]
```

The `resolutions` are used to define the streams fields that should be in the GraphQL type. You can either:

- Define only stream field name (like 'slugs'). The generator will use the `default_field_bindings` to resolve the GraphQL type automatically.
- Define the stream field name and a custom GraphQL field type. This is usually done with relationship fields or if you want to add some directive(s) to the field.

### Generate

[](#generate)

After modifying the `config.php` or any of the defined `schema.imports` files you need to generate the output schema by running

```
php artisan api:generate

```

This will generate the schema in the configured `schema.output` file path.

License
-------

[](#license)

Copyright 2018 - Robin Radic - [MIT License](./LICENSE.md)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

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

4

Last Release

2773d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/303828383a9c2bf382436a61f4471425428b28c095c6df9a9714444cbc163538?d=identicon)[radic](/maintainers/radic)

---

Tags

apirestgraphqlStreamspyrocmsrestfull

### Embed Badge

![Health badge](/badges/radic-graphql-streams-api-module/health.svg)

```
[![Health](https://phpackages.com/badges/radic-graphql-streams-api-module/health.svg)](https://phpackages.com/packages/radic-graphql-streams-api-module)
```

###  Alternatives

[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k48.1M236](/packages/api-platform-core)[gnikyt/basic-shopify-api

A basic Shopify API wrapper with REST and GraphQL support, powered by Guzzle.

245514.8k5](/packages/gnikyt-basic-shopify-api)[lomkit/laravel-rest-api

A package to build quick and robust rest api for the Laravel framework.

59152.2k](/packages/lomkit-laravel-rest-api)[api-platform/openapi

Models to build and serialize an OpenAPI specification.

353.3M48](/packages/api-platform-openapi)[api-platform/symfony

Symfony API Platform integration

323.2M67](/packages/api-platform-symfony)[api-platform/jsonld

API JSON-LD support

233.3M12](/packages/api-platform-jsonld)

PHPackages © 2026

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