Reputation: 310
I tried to use the Parse.com PHP SDK inside a (simple !) Drupal module to send Push notification, but Drupal don't load Parse SDK Classes. I've got PHP error :
PHP Fatal error: Class 'ParseClient' not found
My files are :
push.module
push.info
parse_sdk/autoload.php
parse_sdk/ (and all files from https://github.com/ParsePlatform/parse-php-sdk)
And in the file push.module :
use Parse\ParseClient;
require_once('parse_sdk/autoload.php');
ParseClient::initialize( $app_id, $rest_key, $master_key );
What's wrong with my code ??? Thanks for your help.
Actually it's working with REST API, but I can't get it with PHP SDK. I even tried to insert "files[] = parse_sdk/src/Parse/ParsePush.php" in push.info, wihtout success.
Upvotes: 0
Views: 655
Reputation: 12857
PARSE_PHP_SDK
from here .../root/parse_sdk/
.../root/
(for ex. .../root/example.php
)<?php
namespace Parse;
require_once('parse_sdk/autoload.php');
$url = 'https://api.parse.com/1/push';
$app_id = 'YOUR_app_id';
$rest_key = 'YOUR_rest_key ';
$master_key = 'YOUR_master_key ';
ParseClient::initialize( $app_id, $rest_key, $master_key );
//YOUR OTHER CODE
?>
Upvotes: 0
Reputation: 310
Ok, this my answer :
require_once('parse_sdk/autoload.php');
\Parse\ParseClient::initialize( $app_id, $rest_key, $master_key );
Juste add "\Parse\" and it's work ;-)
Upvotes: 2