Skip to content

Commit

Permalink
Merge pull request #2 from BoltApp/composer-autoloader-init
Browse files Browse the repository at this point in the history
load classes via composer autoloader
  • Loading branch information
danac-gs authored Jan 4, 2019
2 parents 4871a6e + 0cca9b0 commit 893bab7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion example/init_example.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @license https://opensource.org/licenses/MIT MIT License (MIT)
*/

require(dirname(dirname(__FILE__)) . '/init.php');
require(dirname(__DIR__) . '/init.php');
require(dirname(__FILE__) . '/Data.php');
$config = require(dirname(__FILE__) . '/config.php');

Expand Down
21 changes: 15 additions & 6 deletions init.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,18 @@
* @license https://opensource.org/licenses/MIT MIT License (MIT)
*/

require(dirname(__FILE__) . '/lib/ApiClient.php');
require(dirname(__FILE__) . '/lib/Http/CurlClient.php');
require(dirname(__FILE__) . '/lib/Http/Response.php');
require(dirname(__FILE__) . '/lib/SignatureVerifier.php');
require(dirname(__FILE__) . '/lib/Bolt.php');
require(dirname(__FILE__) . '/lib/Helper.php');
// Composer autoloader path
$vendorAutoload = dirname(dirname(__DIR__)) . '/autoload.php';

if (file_exists($vendorAutoload)) {
// Load classes via composer autoloader
require($vendorAutoload);
} else {
// Preload library classes
require(dirname(__FILE__) . '/lib/ApiClient.php');
require(dirname(__FILE__) . '/lib/Http/CurlClient.php');
require(dirname(__FILE__) . '/lib/Http/Response.php');
require(dirname(__FILE__) . '/lib/SignatureVerifier.php');
require(dirname(__FILE__) . '/lib/Bolt.php');
require(dirname(__FILE__) . '/lib/Helper.php');
}
4 changes: 1 addition & 3 deletions lib/playground.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
* @license https://opensource.org/licenses/MIT MIT License (MIT)
*/

require(dirname(__FILE__) . '/ApiClient.php');
require(dirname(__FILE__) . '/Http/CurlClient.php');
require(dirname(__FILE__) . '/Http/Response.php');
require(dirname(__DIR__) . '/init.php');

$client = new \BoltPay\ApiClient([
'api_key' => 'c117fec29f5c1365dacbc62390b5b6f98c0698a812d7015849319f9f7b863064',
Expand Down

0 comments on commit 893bab7

Please sign in to comment.