Download the PHP package youshido/graphql-bundle without Composer

On this page you can find all versions of the php package youshido/graphql-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package graphql-bundle

Symfony GraphQl Bundle

This is a bundle based on the pure PHP GraphQL Server implementation

This bundle provides you with:

There are simple demo application to demonstrate how we build our API, see GraphQLDemoApp.

Table of Contents

Installation

We assume you have composer, if you're not – install it from the official website.
If you need any help installing Symfony framework – here's the link http://symfony.com/doc/current/book/installation.html.

Shortcut to install Symfony: composer create-project symfony/framework-standard-edition my_project_name

Once you have your composer up and running – you're ready to install the GraphQL Bundle.
Go to your project folder and run:

Then enable bundle in your app/AppKernel.php

Add the routing reference to the app/config/routing.yml:

or

If you don't have a web server configured you can use a bundled version, simply run php bin/console server:run.

Let's check if you've done everything right so far – try to access url localhost:8000/graphql.
You should get a JSON response with the following error:

That's because there was no GraphQL Schema specified for the processor yet. You need to create a GraphQL Schema class and set it inside your app/config/config.yml file.

There is a way where you can use inline approach and do not create a Schema class, in order to do that you have to define your own GraphQL controller and use a ->setSchema method of the processor to set the Schema.

The fastest way to create a Schema class is to use a generator shipped with this bundle:

Here AppBundle is a name of the bundle where the class will be generated in.
You will be requested for a confirmation to create a class.

After you've added parameters to the config file, try to access the following link in the browser – http://localhost:8000/graphql?query={hello(name:World)}

Alternatively, you can execute the same request using CURL client in your console
curl http://localhost:8000/graphql --data "query={ hello(name: \"World\") }"

Successful response from a test Schema will be displayed:

That means you have GraphQL Bundle for the Symfony Framework configured and now can architect your GraphQL Schema:

Next step would be to link assets for GraphiQL Explorer by executing:

Now you can access it at http://localhost:8000/graphql/explorer

Symfony features

Class AbstractContainerAwareField:

AbstractContainerAwareField class used for auto passing container to field, add ability to use container in resolve function:

Service method as callable:

Ability to pass service method as resolve callable:

Events:

You can use the Symfony Event Dispatcher to get control over specific events which happen when resolving graphql queries.

Configuration

Now configure you subscriber so events will be caught. This can be done in Symfony by either XML, Yaml or PHP.

Security:

Bundle provides two ways to guard your application: using black/white operation list or using security voter.

Black/white list

Used to guard some root operations. To enable it you need to write following in your config.yml file:

Using security voter:

Used to guard any field resolve and support two types of guards: root operation and any other field resolving (including internal fields, scalar type fields, root operations). To guard root operation with your specified logic you need to enable it in configuration and use SecurityManagerInterface::RESOLVE_ROOT_OPERATION_ATTRIBUTE attribute. The same things need to do to enable field guard, but in this case use SecurityManagerInterface::RESOLVE_FIELD_ATTRIBUTE attribute. Official documentation about voters.

Note: Enabling field security lead to a significant reduction in performance

Config example:

Voter example (add in to your services.yml file with tag security.voter):

GraphiQL extension:

To run graphiql extension just try to access to http://your_domain/graphql/explorer

Documentation

All detailed documentation is available on the main GraphQL repository – http://github.com/youshido/graphql/.


All versions of graphql-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
youshido/graphql Version ~1.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package youshido/graphql-bundle contains the following files

Loading the files please wait ....