infinityloop-dev/graphpinator-printer 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

infinityloop-dev/graphpinator-printer

Composer 安装命令:

composer require infinityloop-dev/graphpinator-printer

包简介

Schema printing visitor for GraPHPinator typesystem.

README 文档

README

⚡🌐⚡ Schema printing visitor for GraPHPinator typesystem.

Introduction

This library allows printing of the GraphQL schema into human-readable format. It supports multiple output formats and ordering options.

Installation

Install package using composer

composer require infinityloop-dev/graphpinator-printer

How to use

Usage of this library is very simple.

$schema; // instance of \Graphpinator\Typesystem\Schema
$printer = new \Graphpinator\Printer\Printer();

echo $printer->printSchema($schema);

Advanced configiration options (see description below)

$schema; // instance of \Graphpinator\Typesystem\Schema
$printer = new \Graphpinator\Printer\Printer(
    new \Graphpinator\Printer\HtmlVisitor( // different format
        new \Graphpinator\Printer\ImplicitInheritanceFieldCollector(), // enable implicit inheritance
    ),
    new \Graphpinator\Printer\TypeKindSorter(), // different sorter
);

echo $printer->printSchema($schema);

Format

It is possible to implement additional printing mechanisms for various output formats. This is done by implementing \Graphpinator\Printer\PrintComponentVisitor and passing an instance to Printer as first constructor argument.

Implementations provided by this library:

  • TextVisitor (default) - standard mechanism which creates text output
  • HtmlVisitor - mechanism which creates structured HTML code (there is also a SCSS bundled in the theme folder and compiled CSS in build folder)

Implicit inheritance

Both formatters support Implicit inheritance RFC - option to exclude fields inherited from parent interface. In order to enable implicit inheritance, it is needed to pass different FieldCollector strategy to TextVisitor or HtmlVisitor.

Strategies provided by this library:

  • AllFieldCollector (default) - standard strategy to print all fields
  • ImplicitInheritanceFieldCollector - strategy to leverage Implicit inheritance RFC, inherited fields which remained the same are excluded

Order of types

It is possible to change the order of types/directives in output. This is done by implementing \Graphpinator\Printer\Sorter and passing an instance to Printer as second constructor argument.

Implementations provided by this library:

  • AlphabeticalSorter (default) - sorts types and directives alphabetically
  • TypeKindSorter - sorts types by their TypeKind (and then alphabetically) - interfaces first, then object types, then unions, ..., directives last

统计信息

  • 总下载量: 22.17k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 9
  • 依赖项目数: 2
  • 推荐数: 1

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-02-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固