graphqlite

Use PHP Annotations to declare your GraphQL API

Github星跟踪图


A library that allows you to write your GraphQL queries in simple-to-write controllers.

Features

  • Create a complete GraphQL API by simply annotating your PHP classes
  • Framework agnostic, but Symfony bundle available!
  • Comes with batteries included :battery:: queries, mutations, mapping of arrays / iterators, file uploads, extendable types and more!

Basic example

First, declare a query in your controller:

class ProductController
{
    /**
     * @Query()
     */
    public function product(string $id): Product
    {
        // Some code that looks for a product and returns it.
    }
}

Then, annotate the Product class to declare what fields are exposed to the GraphQL API:

/**
 * @Type()
 */
class Product
{
    /**
     * @Field()
     */
    public function getName(): string
    {
        return $this->name;
    }
    // ...
}

That's it, you're good to go :tada:! Query and enjoy!

{
  product(id: 42) {
    name
  }
}

Want to learn more? Head to the documentation!

Badges

Latest Stable Version
Total Downloads
Latest Unstable Version
License
Scrutinizer Code Quality
Build Status
Coverage Status

主要指标

概览
名称与所有者thecodingmachine/graphqlite
主编程语言MDX
编程语言PHP (语言数: 5)
平台
许可证MIT License
所有者活动
创建于2019-01-29 21:09:22
推送于2025-11-11 04:01:27
最后一次提交2025-10-11 02:58:35
发布数30
最新版本名称v8.1.1 (发布于 )
第一版名称v3.0.0 (发布于 )
用户参与
星数564
关注者数17
派生数106
提交数1.3k
已启用问题?
问题数263
打开的问题数33
拉请求数387
打开的拉请求数6
关闭的拉请求数70
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?