PHPackages                             ecodev/graphql-upload - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. ecodev/graphql-upload

ActiveLibrary[File &amp; Storage](/categories/file-storage)

ecodev/graphql-upload
=====================

A middleware to support file uploads in GraphQL

8.0.1(4mo ago)902.2M↓27%1911MITPHPPHP ^8.4CI passing

Since Jan 19Pushed 2mo ago10 watchersCompare

[ Source](https://github.com/Ecodev/graphql-upload)[ Packagist](https://packagist.org/packages/ecodev/graphql-upload)[ RSS](/packages/ecodev-graphql-upload/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (36)Used By (11)

GraphQL Upload
==============

[](#graphql-upload)

[![Build Status](https://github.com/ecodev/graphql-upload/workflows/main/badge.svg)](https://github.com/ecodev/graphql-upload/actions)[![Total Downloads](https://camo.githubusercontent.com/bede706b070d442827228fc6ab27e139cf8badaa18a238375b8702ff8bce66dc/68747470733a2f2f706f7365722e707567782e6f72672f65636f6465762f6772617068716c2d75706c6f61642f646f776e6c6f6164732e706e67)](https://packagist.org/packages/ecodev/graphql-upload)[![Latest Stable Version](https://camo.githubusercontent.com/fa68f85be79dffa509f263f9b06a60e74b3acc3347782d7cbf2e50860c487712/68747470733a2f2f706f7365722e707567782e6f72672f65636f6465762f6772617068716c2d75706c6f61642f762f737461626c652e706e67)](https://packagist.org/packages/ecodev/graphql-upload)[![License](https://camo.githubusercontent.com/ec34e22eb182c733cbbe100730a05a4a6cd89c28e2b0f5513aad6ad6a1e01b58/68747470733a2f2f706f7365722e707567782e6f72672f65636f6465762f6772617068716c2d75706c6f61642f6c6963656e73652e706e67)](https://packagist.org/packages/ecodev/graphql-upload)

A [PSR-15](https://www.php-fig.org/psr/psr-15/) middleware to support file uploads in GraphQL. It implements [the multipart request specification](https://github.com/jaydenseric/graphql-multipart-request-spec)for [webonyx/graphql-php](https://github.com/webonyx/graphql-php).

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

[](#quick-start)

Install the library via composer:

```
composer require ecodev/graphql-upload
```

### Configure as middleware

[](#configure-as-middleware)

In Laminas Mezzio, it would typically be in `config/routes.php` something like:

```
use Application\Action\GraphQLAction;
use Mezzio\Helper\BodyParams\BodyParamsMiddleware;
use GraphQL\Upload\UploadMiddleware;

$app->post('/graphql', [
    BodyParamsMiddleware::class,
    UploadMiddleware::class, // This is the magic
    GraphQLAction::class,
], 'graphql');
```

#### Other frameworks

[](#other-frameworks)

This lib is an implementation of PSR-15, so it can be used with any framework supporting PSR-15. For specific configuration instructions, refer to your framework documentation.

If your framework does not support PSR-15 middleware, you will probably need some kind of bridge. Again, refer to your framework for specific instructions.

### Usage in schema

[](#usage-in-schema)

Then you can start using in your mutations like so:

```
