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 13:09:22
推送于2025-06-07 01:03:50
最后一次提交2025-06-06 17:43:09
发布数29
最新版本名称v8.1.0 (发布于 2025-06-06 21:02:50)
第一版名称v3.0.0 (发布于 )
用户参与
星数561
关注者数18
派生数101
提交数1.2k
已启用问题?
问题数257
打开的问题数29
拉请求数380
打开的拉请求数0
关闭的拉请求数70
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?