DPC2019: Performant APIs with GraphQL and PHP - Andrew Rota

Learn how to build performant APIs with GraphQL and PHP, covering topics such as query language, authorization, lazy loading, tooling, caching, ORMs, and more, discussing the challenges and benefits of using GraphQL in different contexts.

Key takeaways
  • GraphQL provides a new paradigm for building APIs: It’s a query language for APIs that allows for flexible and efficient data retrieval.
  • Client-side GraphQL is just plain old JavaScript code: It’s a technology agnostic query language, so you can use it with any frontend technology.
  • Some challenges with GraphQL are similar to those with other APIs: Such as handling large datasets, dealing with nested fields, and addressing security and performance concerns.
  • Authorization is important in GraphQL, just like in other APIs: You should consider implementing authorization logic to control data access and integrity.
  • Lazy loading and deferring can help optimize queries: This is especially useful when dealing with large datasets or complex queries.
  • Tooling for GraphQL is essential: Apollo Codegen is a great example of a tool that can help generate types and introspection functionality.
  • Caching is important, but challenging: Caching GraphQL results can be challenging, but there are libraries like Loca that can help.
  • For efficient data retrieval, consider using ORMs: Object Relational Mappers can help simplify data access and caching, but they’re not always the best choice.
  • Some performance-sensitive applications may benefit from GraphQL: For example, those that involve multiple clients or require efficient caching and query optimization.
  • Native app developers may need to use GraphQL differently than web developers: They may need to consider different architecture and caching strategies, for instance.
  • Some developers may face challenges with data management on the client side: GraphQL can help address these challenges, but it’s still important to consider data access and caching.
  • There are various libraries and tools that support GraphQL: Such as Apollo, GraphQL Client, and Voyager.
  • The future of GraphQL looks bright: With ongoing development and support from the community, GraphQL is becoming a powerful tool for building APIs.