Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Up and Running with Graphql in Laravel

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on. →
Avatar for Chuka Chuka
October 20, 2018

Up and Running with Graphql in Laravel

Avatar for Chuka

Chuka

October 20, 2018

Other Decks in Programming

Transcript

  1. Up and running with GRAPHQL in Laravel Up and running

    with GRAPHQL in Laravel Chukwuka Nnorukah Chukwuka Nnorukah
  2. • What is Graphql • Why Graphql? • Introducing graphql

    • Schemas and Types • What is Graphql • Why Graphql? • Introducing graphql • Schemas and Types Agenda Agenda
  3. • Queries and Mutations • GraphQL language basics • Using

    graphql in php and laravel • Lighthouse gives you superpowers • Great Resources • Queries and Mutations • GraphQL language basics • Using graphql in php and laravel • Lighthouse gives you superpowers • Great Resources Agenda Agenda
  4. What is GraphQL? What is GraphQL? “GraphQL is a query

    language for your API, and a server-side runtime for executing queries by using a type system you define for your data.” “GraphQL is a query language for your API, and a server-side runtime for executing queries by using a type system you define for your data.”
  5. A query A query query{ courses{ id title description }

    } query{ courses{ id title description } } { "data": { "courses": [ { "id": "Q291cnNlOjE=", "title": "Explicabo aliquid mollitia ...", "description": "Perspiciatis qui debitis non qui..." }, ... ] } } { "data": { "courses": [ { "id": "Q291cnNlOjE=", "title": "Explicabo aliquid mollitia ...", "description": "Perspiciatis qui debitis non qui..." }, ... ] } }
  6. • Strong typing for your query data • Request exactly

    the data you need • Amazing flexibility • API documenation comes automatically • Strong typing for your query data • Request exactly the data you need • Amazing flexibility • API documenation comes automatically Boons on the frontend Boons on the frontend
  7. GraphQL runtime GraphQL runtime Stack specific implement of Type definitions,

    Queries and mutation that provide structured access to business logic data Stack specific implement of Type definitions, Queries and mutation that provide structured access to business logic data
  8. GraphQL runtime GraphQL runtime It is tool for describing your

    models and their relationships (like Eloquent), setting rules for accessing (like your read/show actions) and changing them (the RUD in cRUD). It is tool for describing your models and their relationships (like Eloquent), setting rules for accessing (like your read/show actions) and changing them (the RUD in cRUD).
  9. It’s ALL TYPES! It’s ALL TYPES! • The graphql schema

    is a “GRAPH” of your business logic’s resources. • Inputs are types • Outputs are types • Queries, Mutations … all types • The graphql schema is a “GRAPH” of your business logic’s resources. • Inputs are types • Outputs are types • Queries, Mutations … all types
  10. GraphQL Schema Language GraphQL Schema Language https://raw.githubusercontent.com/sogko/gra phql-shorthand-notation-cheat- sheet/master/graphql-shorthand-notation- cheat-sheet.png

    https://raw.githubusercontent.com/sogko/gra phql-shorthand-notation-cheat- sheet/master/graphql-shorthand-notation- cheat-sheet.png
  11. Nuvave’s Lightouse Nuvave’s Lightouse • PHP package that allows you

    to serve a GraphQL endpoint from your Laravel application. • Greatly reduces the boilerplate required • Integrates well with existing Laravel projects • Highly customizable • PHP package that allows you to serve a GraphQL endpoint from your Laravel application. • Greatly reduces the boilerplate required • Integrates well with existing Laravel projects • Highly customizable
  12. Great Resources Great Resources • https://github.com/chentsulin/awesome-graphql#php-libraries • https://github.com/webonyx/graphql-php • https://github.com/Folkloreatelier/laravel-graphql

    • https://graphql.org/learn/ • https://medium.com/@olivernybroe/graphql-in-laravel-done-right-9cf123d5 601b • https://github.com/mll-lab/laravel-graphql-playground • https://medium.com/@olivernybroe/testing-graphql-with-laravel- 4d6201b40f68 • https://github.com/chentsulin/awesome-graphql#php-libraries • https://github.com/webonyx/graphql-php • https://github.com/Folkloreatelier/laravel-graphql • https://graphql.org/learn/ • https://medium.com/@olivernybroe/graphql-in-laravel-done-right-9cf123d5 601b • https://github.com/mll-lab/laravel-graphql-playground • https://medium.com/@olivernybroe/testing-graphql-with-laravel- 4d6201b40f68