Source: medium.com

Consuming the Sonar API

Category: PHP, api

In the first three articles in this series, I walked you through how to use the API using GraphiQL, a web based tool included in Sonar. Using the Sonar GraphQL API in an external application is pretty simple.

As a query and a mutation can both take input data, we use a POST to submit to the server, and receive JSON in response.

I’m going to use Guzzle as my HTTP client in this case.

I personally like to use heredoc syntax to write out my query.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners