public api php for graphcomment
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Scrutinizer Code Quality Build Status

#Graphcomment SDK API PHP version 2.0

install with composer :

composer require graphcomment/sdk-api-php

  • The Wrapper use the last version of Guzzle.

  • To use the PHP Wrapper you must create an account on and subscribe a paid plan.

With this wrapper you will be able to :

  • Register automatically a new User on GraphComment whenever he subscribe on your website.
  • Connect a user to GraphComment when he logs in to your website.
  • Get the user information saved in graphcomment.
  • Update the user information from your system to graphcomment.
  • Get the count of comments active on a thread.

Example of implementation :

$client = new Sdk(GC_PUBLIC_KEY, GC_SECRET_KEY);

after theses lines, you call the functions.

  • register a User

$client->registerUser('username', 'email', 'fr', '');

This function return a json file containing its "gc_id" that must be save in your database to authenticate a user that is logging in and do_sync date of synchronisation to save too.

  • login a User, this function return the token JWT as JSON that you must save in localStorage to authenticate Graphcomment.


to save in localStorage the gc_token, call this url in an iframe with 0px width, 0px width of user to authenticate him =>[TOKEN-without-JWT-only-token]

to destroy session localStorage, call this url in an iframe with 0px width, 0px width of user =>

Example :

Connexion :

<iframe src=" " frameborder="0" style="width:0px;height:0px;"></iframe>

Disconnection :

<iframe src="" frameborder="0" style="width:0px;height:0px;"></iframe>

  • Get last informations from a user


get user's informations, return a JSON.

	gc_id: 'gc_id',
	username: 'username',
	email: '',
	language : 'en',
	picture : '',
	do_sync : date of synchronisation
  • Update a User on Graphcomment

$client->updateUser('gc_id', 'username', 'email', 'fr', '');

return do_sync date and gc_id with state 'updated'

  • Count Comments of a thread

$client->countCommentscountComments('', 'content123');