thecodingmachine/graphqlite-bundle
Composer 安装命令:
composer require thecodingmachine/graphqlite-bundle
包简介
A Symfony bundle for thecodingmachine/graphqlite.
README 文档
README
GraphQLite bundle
Symfony bundle for the thecodingmachine/graphqlite package.
It discovers your annotated controllers and types, builds the schema, exposes the /graphql endpoint through a PSR-7
bridge (with optional upload handling), and keeps the Symfony request available as the GraphQL context.
Part of the bundle docs: https://graphqlite.thecodingmachine.io/docs/symfony-bundle
See thecodingmachine/graphqlite.
Requirements
- PHP 8.1+
- Supports:
- Symfony 6.4/7.0/8.0
- GraphQLite ^8
Installation
composer require thecodingmachine/graphqlite-bundle
Ensure the bundle is enabled (Symfony Flex does this automatically via config/bundles.php after composer require).
Configure routes
Import the bundle routes to expose /graphql:
# config/routes/graphqlite.yaml graphqlite_bundle: resource: '@GraphQLiteBundle/Resources/config/routes.php'
Configure namespaces
Tell GraphQLite where to look for controllers and types:
# config/packages/graphqlite.yaml graphqlite: namespace: controllers: App\\GraphQL\\Controller types: - App\\GraphQL\\Type - App\\Entity
Quickstart
Create a controller with GraphQLite attributes:
<?php // src/GraphQL/Controller/HelloController.php namespace App\GraphQL\Controller; use TheCodingMachine\GraphQLite\Annotations\Query; final class HelloController { #[Query] public function hello(string $name = 'world'): string { return sprintf('Hello %s', $name); } }
Features
- Auto-discovers controllers and types from configured namespaces and registers GraphQLite services, query providers, type mappers, and middleware through Symfony autoconfiguration
- Ships a
/graphqlroute that converts Symfony requests to PSR-7 and keeps the Symfony request in the GraphQL context - Passes the Symfony request as context to allow using them in queries/mutations
- Supports multipart uploads when
graphql-uploadis installed - Integrates with Symfony Security for
#[Logged]/#[Right]checks - Expose
login/logoutmutations plus amequery (opt-out) - Symfony Validator-based user input validation
- Lets you cap introspection, query depth, and query complexity via configuration
- Uses Symfony cache (APCu or PHP files) for schema caching
- Includes a
graphqlite:dump-schemaconsole command to export GraphQL SDL
GraphiQL (playground)
The bundle wires Overblog’s GraphiQL bundle if it is installed. See https://github.com/overblog/GraphiQLBundle for
enabling the UI alongside the /graphql endpoint.
Development
- Tests:
vendor/bin/phpunit - Static analysis:
composer phpstan
thecodingmachine/graphqlite-bundle 适用场景与选型建议
thecodingmachine/graphqlite-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.69M 次下载、GitHub Stars 达 37, 最近一次更新时间为 2019 年 01 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「bundle」 「graphql」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 thecodingmachine/graphqlite-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 thecodingmachine/graphqlite-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 thecodingmachine/graphqlite-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
2lenet/EasyAdminPlusBundle
GraphQL authentication for your headless Craft CMS applications.
The bundle for easy using json-rpc api on your project
Provide a way to secure accesses to all routes of an symfony application.
DMS Meetup API Bundle, enables Meetup API clients in services
Authorize introspection documentarion for rebing/graphql-laravel
统计信息
- 总下载量: 1.69M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 37
- 点击次数: 13
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-01-29