Skip to content

Commit 48fcc7b

Browse files
committed
Remove reliance on composer
- Some users don't use composer and the code required the composer.json - Resolves #95
1 parent cdd84a8 commit 48fcc7b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

composer.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
"name": "sparkpost/php-sparkpost",
33
"description": "Client library for interfacing with the SparkPost API.",
44
"license": "Apache 2.0",
5-
"version": "1.1.0",
65
"authors": [
76
{
8-
"name": "Message Systems, Inc."
7+
"name": "SparkPost"
98
}
109
],
1110
"minimum-stability": "stable",

lib/SparkPost/SparkPost.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ class SparkPost {
88
public $transmission;
99
public $messageEvents;
1010

11+
/**
12+
* Library version, used for setting User-Agent.
13+
*/
14+
private $version = '1.1.0';
15+
1116
/**
1217
* Connection config for making requests.
1318
*/
@@ -80,15 +85,11 @@ public function getHttpHeaders() {
8085
* @return Configuration
8186
*/
8287
private function getHttpConfig($config) {
83-
// get composer.json to extract version number
84-
$composerFile = file_get_contents(dirname(__FILE__) . '/../../composer.json');
85-
$composer = json_decode($composerFile, true);
86-
8788
// create Configuration for http adapter
8889
$httpConfig = new Configuration();
8990
$baseUrl = $config['protocol'] . '://' . $config['host'] . ($config['port'] ? ':' . $config['port'] : '') . '/api/' . $config['version'];
9091
$httpConfig->setBaseUri($baseUrl);
91-
$httpConfig->setUserAgent('php-sparkpost/' . $composer['version']);
92+
$httpConfig->setUserAgent('php-sparkpost/' . $this->version);
9293
return $httpConfig;
9394
}
9495

0 commit comments

Comments
 (0)