diff --git a/classes/gdata.php b/classes/gdata.php index 0d2ec72..88adbcb 100644 --- a/classes/gdata.php +++ b/classes/gdata.php @@ -2,6 +2,15 @@ namespace Gdata; +if (file_exists(__DIR__.'/../vendor/autoload.php')) +{ + require_once __DIR__.'/../vendor/autoload.php'; +} +else +{ + require_once VENDORPATH.'autoload.php'; +} + /** * FuelPHP Gdata package * @@ -101,11 +110,7 @@ public static function instance($instance = null) */ public function __construct($service, array $config) { - require_once PKGPATH."gdata/vendor/google-api-php-client/src/Google_Client.php"; - - $service_class = 'Google_'.ucfirst(strtolower($service)).'Service'; - require_once PKGPATH."gdata/vendor/google-api-php-client/src/contrib/{$service_class}.php"; - + $service_class = '\Google_Service_'.$service; if( ! class_exists($service_class)) { throw new \FuelException('Could not find Gdata service class: '.$service_class); diff --git a/composer.json b/composer.json index f5a1377..54e2e59 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,8 @@ "name": "mp-php/fuel-packages-gdata", "type": "fuel-package", "require": { - "composer/installers": "*" + "composer/installers": "*", + "google/apiclient": "1.*@dev" }, "extra": { "installer-name": "gdata"