PHP code example of youshido / graphql-files-bundle

1. Go to this page and download the library: Download youshido/graphql-files-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

youshido / graphql-files-bundle example snippets




use Youshido\GraphQLFilesBundle\GraphQL\Field\UploadBase64ImageField;
use Youshido\GraphQLFilesBundle\GraphQL\Field\UploadImageField;
use Youshido\GraphQLFilesBundle\GraphQL\Field\UploadFileField;

class MutationType extends AbstractObjectType
{

    public function build($config)
    {

        $config->addFields([
            // images
            new UploadBase64ImageField(),
            new UploadImageField(),
            
            // files
            new UploadFileField(),

            // other mutations
        ]);

    }
}

 php
$bundles[] = new Youshido\GraphQLFilesBundle\GraphQLFilesBundle()
 php

use Youshido\GraphQLFilesBundle\GraphQL\Field\ImageField;

class YourType extends AbstractObjectType
{

    public function build($config)
    {
        $config->addFields([
            // your type fields
        
            new ImageField()
        ]);
    }
}