Download the PHP package kronostechnologies/graphql-generator without Composer

On this page you can find all versions of the php package kronostechnologies/graphql-generator. 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-generator

graphql-generator

CircleCI Coverage Status

Converts a GraphQL Schema to static PHP files. It currently supports generating namespaced class file. The tool is interfaced through a CLI.

Requirements

Installation

The repository can be cloned in order to gain access to the GraphQL generator.

Examples

The examples source directory contains some graphqls schema examples on which you can run the tool against.

Simple schema generation

To generate class files from a valid graphqls file, run the following command:

The output files will appear in the base directory.

Testing

Run unit tests with PHPUnit 5.7.

Usage

You can run the CLI tool with the following command:

Arguments are:

Available options are:

Namespaced Writer

Although the namespaced writer is currently the only writer supported, it comes with a few options bundled:

Additional files

In addition to generating the type definitions for each type, the following files are generated.

All types are statically initialized in the TypeStore. This helps ensure only a single instance of a type definition throughout the application. The properties of each type are stored independently in a DTO.

TypeStore location:

For input types, and Union types, a resolver is created. This file is intended to be editable by the user of this tool, and to split the type definition from the actual code. The resolvers are initialized through the ResolverFactory. This allows passing external values to the resolvers constructors.

Resolvers namespace format:

Additionally, for input types, a DTO is created. DTO serve as a data structure that should ultimately be returned by the resolver functions. It is important to separate these concerns as a type definition can only exist once (hence the need of a TypeStore), but a DTO can exist multiple times throughout the application.

DTO namespace format:

Interfaces use composition instead of inheritance due to GraphQL being able to implement multiple of them. They are declared in two components: a trait, and a bare class implementing this trait. The trait contains all members.

Stub Files

The stub files are used as a boilerplate for generating the files of a specific GraphQL type. For the namespaced Writer, the files required are the same ones in src/Generator/Writer/Namespaced/stubs.

For example, an interface type will use interface.stub as its base file for generating the class. The following types are matched:

Additionally, typestore.stub is matched to the TypeStore, dto.stub to DTOs, and resolver.stub to resolvers.

See src/Generator/Writer/Namespaced/stubs for the stub files content.

Mutations

Mutations are currently ignored when generating the GraphQL files. As these mostly imply logical operations, you will need to implement the resolve functions yourself.


All versions of graphql-generator with dependencies

PHP Build Version
Package Version
Requires webonyx/graphql-php Version ^0.11
symfony/console Version ^2.2
psr/log Version ^1.0
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 kronostechnologies/graphql-generator contains the following files

Loading the files please wait ....