summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Leland <rich@richleland.com>2016-05-03 21:01:01 -0400
committerRichard Leland <rich@richleland.com>2016-05-03 21:01:01 -0400
commit48fcc7b0d1eb204a0a49c50f85dde16fbcb5c6b5 (patch)
treeb39775b9c66e0e3b9eaf5868e84524d1ce4803fb
parentcdd84a81dc4e834c309001aa84c7ac7e7350f8d2 (diff)
downloadphp-sparkpost-48fcc7b0d1eb204a0a49c50f85dde16fbcb5c6b5.zip
php-sparkpost-48fcc7b0d1eb204a0a49c50f85dde16fbcb5c6b5.tar.gz
php-sparkpost-48fcc7b0d1eb204a0a49c50f85dde16fbcb5c6b5.tar.bz2
Remove reliance on composer
- Some users don't use composer and the code required the composer.json - Resolves #95
-rw-r--r--composer.json3
-rw-r--r--lib/SparkPost/SparkPost.php11
2 files changed, 7 insertions, 7 deletions
diff --git a/composer.json b/composer.json
index 470c1b4..be447ce 100644
--- a/composer.json
+++ b/composer.json
@@ -2,10 +2,9 @@
"name": "sparkpost/php-sparkpost",
"description": "Client library for interfacing with the SparkPost API.",
"license": "Apache 2.0",
- "version": "1.1.0",
"authors": [
{
- "name": "Message Systems, Inc."
+ "name": "SparkPost"
}
],
"minimum-stability": "stable",
diff --git a/lib/SparkPost/SparkPost.php b/lib/SparkPost/SparkPost.php
index e5f029a..ffc84f0 100644
--- a/lib/SparkPost/SparkPost.php
+++ b/lib/SparkPost/SparkPost.php
@@ -9,6 +9,11 @@ class SparkPost {
public $messageEvents;
/**
+ * Library version, used for setting User-Agent.
+ */
+ private $version = '1.1.0';
+
+ /**
* Connection config for making requests.
*/
private $config;
@@ -80,15 +85,11 @@ class SparkPost {
* @return Configuration
*/
private function getHttpConfig($config) {
- // get composer.json to extract version number
- $composerFile = file_get_contents(dirname(__FILE__) . '/../../composer.json');
- $composer = json_decode($composerFile, true);
-
// create Configuration for http adapter
$httpConfig = new Configuration();
$baseUrl = $config['protocol'] . '://' . $config['host'] . ($config['port'] ? ':' . $config['port'] : '') . '/api/' . $config['version'];
$httpConfig->setBaseUri($baseUrl);
- $httpConfig->setUserAgent('php-sparkpost/' . $composer['version']);
+ $httpConfig->setUserAgent('php-sparkpost/' . $this->version);
return $httpConfig;
}