forked from deskpro/deskpro-api-php
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeskpro-api.php
More file actions
32 lines (28 loc) · 772 Bytes
/
deskpro-api.php
File metadata and controls
32 lines (28 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/*
* This file loads the DeskPRO API in to your PHP project.
*
* 1) Include this file in your project:
*
* require 'deskpro-api.php';
*
* 2) Use the DeskPRO API:
*
* $api = new \DeskPRO\Api('http://example.com/deskpro', '123:XYZ');
*
* To learn more about how to use the API, refer to the README:
* https://github.com/DeskPRO/deskpro-api-php/blob/master/README.md
*/
define('DESKPRO_API_LIB_PATH', realpath(__DIR__.'/src'));
spl_autoload_register(function($classname) {
if (strpos($classname, 'DeskPRO\\') !== 0) {
return false;
}
$path = DESKPRO_API_LIB_PATH . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $classname) . '.php';
if (file_exists($path)) {
require $path;
return true;
} else {
return false;
}
});