定制 odder/lighthouse-scalars 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

odder/lighthouse-scalars

最新稳定版本:0.1.3

Composer 安装命令:

composer require odder/lighthouse-scalars

包简介

A collection of custom scalar types for usage with https://github.com/webonyx/graphql-php

README 文档

README

Latest Version on Packagist Tests Coverage PHP version webonyx/graphql-php Total Downloads License

This package provides a set of custom scalars for the webonyx/graphql-php library, which is used under the hood by Lighthouse, a PHP port of the popular GraphQL server.

Supported Scalars

The following scalars are supported:

😍😍😍:

Numbers:

Localization:

Geography:

Internet:

Markup:

Installation

You can install the package via composer:

composer require odder/lighthouse-scalars

Usage

Using Lighthouse

You can opt-in to the scalars you want by registering them in the TypeRegistry in a service provider. For example, you can register the PositiveFloat and Emoji scalars in the AppServiceProvider:

use Odder\LighthouseScalars\Scalars;
use Nuwave\Lighthouse\Schema\TypeRegistry;

class AppServiceProvider extends ServiceProvider
{
    public function boot()
    {
        ...
    }

    public function register(TypeRegistry $typeRegistry)
    {
        $typeRegistry->register(Scalars::PositiveFloat);
        $typeRegistry->register(Scalars::Emoji);
    }
}

After you have registered the Scalars you need in the TypeRegistry, you can use them in your schema:

type Query {
  mood: Emoji!
  naturalNumber: PositiveFloat!
}

Testing

This package includes a set of tests for each scalar. To run the tests, use the following command:

composer test

Documentation

For more information on how to use each scalar, please refer to the documentation.

Contributing

Contributions are welcome! Please read CONTRIBUTING.md for details on how to contribute to this project.

License

The MIT License (MIT). Please see License File for more information.

Credits

Security

If you discover any security-related issues, please email hi@odder.dev instead of using the issue tracker.

统计信息

  • 总下载量: 759
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-03-03