Skip to content

Comments

[WIP] Add new fully functional PHP example to documentation#1859

Closed
Copilot wants to merge 1 commit intomasterfrom
copilot/add-php-example-to-docs
Closed

[WIP] Add new fully functional PHP example to documentation#1859
Copilot wants to merge 1 commit intomasterfrom
copilot/add-php-example-to-docs

Conversation

Copy link
Contributor

Copilot AI commented Feb 16, 2026

Plan: Add Apollo Odyssey Lift-off Example

Overview

Add a new example (06-apollo-odyssey) based on the Apollo GraphQL tutorial, implementing a track listing API with queries and mutations.

Checklist

  • Create example directory structure /examples/06-apollo-odyssey
  • Copy and adapt core files (models, types, controllers)
    • Create Data directory with mock data
    • Create Type classes (Query, Mutation, Track, Module, Author, Response types)
    • Create TypeRegistry for managing type instances
  • Ensure PSR-4 compliance (one class per file)
  • Create main graphql.php entry point
  • Add composer.json for the example
  • Create comprehensive README.md with:
    • Description of the example
    • Installation instructions
    • Usage examples
    • GraphQL queries/mutations to try
  • Add integration tests using PHPUnit
    • Test queries (tracksForHome, track by ID)
    • Test mutations (incrementTrackNumberOfViews)
    • Create test utilities (SchemaFactory)
  • Update root composer.json autoload-dev
  • Add .gitignore for example-specific files
  • Validate example works with built-in PHP server
  • Run code review
  • Run security scan with CodeQL
Original prompt

This section details on the original issue you should resolve

<issue_title>Add a new fully functional example to the docs</issue_title>
<issue_description>I was studying from the liftoff series in this course for the second time as I needed graphql in a project (I started this course a year ago when I wanted to learn more about graphql in general).

I link their incremental approach of teaching one thing at a time along with the companion illustrations with each lesson.
They use Apollo client and server packages in the course (surely since these are their products), but because I needed to use php in the first place, I had to follow along and incrementally write equivalent code in php.

I thought about sharing the code in php so that any learner coming from their course would have the equivalent code in php in hand, thus making the migration process even easier.

If you agree, I can either:

  1. Add the link of the repo to the docs
  2. If you want full control over the code, I can clone this package(webonyx/graphql-php) and add the code to it(a bit cumbersome, but doable)</issue_description>

Comments on the Issue (you are @copilot in this section)

@spawnia I don't mind adding a link to your example in the docs. A couple of notes: - How do we know it is working? There are no tests? - What is the reason for separating `app` and `src`? What goes where? - Should `GraphQLController` follow PSR-4? @spawnia 1. Yeah, some integration tests to show that the resolvers are working as intended would be great. There can still be mistakes, such as typos in field names, mismatches in data types, etc. Pest is fine with me. 2. I would favor the integration of `src` into `app` as you suggested. 3. `GraphQLController` defines more than one class in one file. I have always just done one class per file, although I am not sure if that is a strict requirement for PSR-0/PSR-4. @spawnia Using a TypeRegistry makes sense, especially for an example like yours that should be at least somewhat complete and production ready-ish.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a new fully functional example to the docs

2 participants