diff --git a/README.md b/README.md index a242c23..4ee7c25 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ If you find a bug in the SDK, please let us know about it. However, before you c - **Minimum requirements** - to use the SDK you must be using OWA core v1.7.0 or later as well as PHP 7+. We highly recommend having your PHP compiled with the cURL extension. -- **Install the SDK** - download a tarball of the latest release or check the code out from a branch in this Github repository. If you do pull the code from a branch, be sure ot run `composer update` in order to pull in all of the dependancies (Guzzle, etc.) that are required. +- **Install the SDK with composer** - composer require open-web-analytics/owa-php-sdk - **User Guide** - reead the [user guide](https://github.com/Open-Web-Analytics/owa-php-sdk/wiki) in order to lear how to work wit hthe SDK. @@ -30,10 +30,9 @@ If you find a bug in the SDK, please let us know about it. However, before you c ### Create a Tracker ### ```php - 'http://your.domain.com/owa/' + 'instance_url' => 'http://your.domain.com/owa/', + 'cookie_domain' => 'your.domain.com' ]; $sdk = new OwaSdk\sdk($config); diff --git a/composer.json b/composer.json index 4ea1bee..2f0c362 100644 --- a/composer.json +++ b/composer.json @@ -15,5 +15,10 @@ }, "require": { "guzzlehttp/guzzle": "~6.0" - } + }, + "autoload": { + "psr-4": { + "OwaSdk\\": "src/" + } + } } diff --git a/composer.lock b/composer.lock index 73d394e..e938dd6 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "guzzlehttp/guzzle", - "version": "6.5.3", + "version": "6.5.5", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "aab4ebd862aa7d04f01a4b51849d657db56d882e" + "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/aab4ebd862aa7d04f01a4b51849d657db56d882e", - "reference": "aab4ebd862aa7d04f01a4b51849d657db56d882e", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/9d4290de1cfd701f38099ef7e183b64b4b7b0c5e", + "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e", "shasum": "" }, "require": { @@ -25,7 +25,7 @@ "guzzlehttp/promises": "^1.0", "guzzlehttp/psr7": "^1.6.1", "php": ">=5.5", - "symfony/polyfill-intl-idn": "^1.11" + "symfony/polyfill-intl-idn": "^1.17.0" }, "require-dev": { "ext-curl": "*", @@ -71,27 +71,31 @@ "rest", "web service" ], - "time": "2020-04-18T10:38:46+00:00" + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/6.5" + }, + "time": "2020-06-16T21:01:06+00:00" }, { "name": "guzzlehttp/promises", - "version": "v1.3.1", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "url": "https://api.github.com/repos/guzzle/promises/zipball/8e7d04f1f6450fef59366c399cfad4b9383aa30d", + "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d", "shasum": "" }, "require": { - "php": ">=5.5.0" + "php": ">=5.5" }, "require-dev": { - "phpunit/phpunit": "^4.0" + "symfony/phpunit-bridge": "^4.4 || ^5.1" }, "type": "library", "extra": { @@ -122,20 +126,24 @@ "keywords": [ "promise" ], - "time": "2016-12-20T10:07:11+00:00" + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/1.4.1" + }, + "time": "2021-03-07T09:25:29+00:00" }, { "name": "guzzlehttp/psr7", - "version": "1.6.1", + "version": "1.8.2", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a" + "reference": "dc960a912984efb74d0a90222870c72c87f10c91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/dc960a912984efb74d0a90222870c72c87f10c91", + "reference": "dc960a912984efb74d0a90222870c72c87f10c91", "shasum": "" }, "require": { @@ -148,15 +156,15 @@ }, "require-dev": { "ext-zlib": "*", - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" }, "suggest": { - "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6-dev" + "dev-master": "1.7-dev" } }, "autoload": { @@ -193,7 +201,11 @@ "uri", "url" ], - "time": "2019-07-01T23:21:34+00:00" + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/1.8.2" + }, + "time": "2021-04-26T09:17:50+00:00" }, { "name": "psr/http-message", @@ -243,6 +255,9 @@ "request", "response" ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/master" + }, "time": "2016-08-06T14:39:51+00:00" }, { @@ -283,25 +298,29 @@ } ], "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, "time": "2019-03-08T08:55:37+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.17.0", + "version": "v1.23.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "3bff59ea7047e925be6b7f2059d60af31bb46d6a" + "reference": "65bd267525e82759e7d8c4e8ceea44f398838e65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/3bff59ea7047e925be6b7f2059d60af31bb46d6a", - "reference": "3bff59ea7047e925be6b7f2059d60af31bb46d6a", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/65bd267525e82759e7d8c4e8ceea44f398838e65", + "reference": "65bd267525e82759e7d8c4e8ceea44f398838e65", "shasum": "" }, "require": { - "php": ">=5.3.3", - "symfony/polyfill-mbstring": "^1.3", + "php": ">=7.1", + "symfony/polyfill-intl-normalizer": "^1.10", "symfony/polyfill-php72": "^1.10" }, "suggest": { @@ -310,7 +329,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -330,6 +353,10 @@ "name": "Laurent Bassin", "email": "laurent@bassin.info" }, + { + "name": "Trevor Rowbotham", + "email": "trevor.rowbotham@pm.me" + }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" @@ -345,6 +372,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.23.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -359,40 +389,47 @@ "type": "tidelift" } ], - "time": "2020-05-12T16:47:27+00:00" + "time": "2021-05-27T09:27:20+00:00" }, { - "name": "symfony/polyfill-mbstring", - "version": "v1.17.0", + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.23.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "fa79b11539418b02fc5e1897267673ba2c19419c" + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fa79b11539418b02fc5e1897267673ba2c19419c", - "reference": "fa79b11539418b02fc5e1897267673ba2c19419c", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "suggest": { - "ext-mbstring": "For best performance" + "ext-intl": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" }, "files": [ "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -409,15 +446,19 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for the Mbstring extension", + "description": "Symfony polyfill for intl's Normalizer class and related functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "mbstring", + "intl", + "normalizer", "polyfill", "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -432,29 +473,33 @@ "type": "tidelift" } ], - "time": "2020-05-12T16:47:27+00:00" + "time": "2021-02-19T12:13:01+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.17.0", + "version": "v1.23.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "f048e612a3905f34931127360bdd2def19a5e582" + "reference": "9a142215a36a3888e30d0a9eeea9766764e96976" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/f048e612a3905f34931127360bdd2def19a5e582", - "reference": "f048e612a3905f34931127360bdd2def19a5e582", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976", + "reference": "9a142215a36a3888e30d0a9eeea9766764e96976", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -487,6 +532,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-php72/tree/v1.23.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -501,7 +549,7 @@ "type": "tidelift" } ], - "time": "2020-05-12T16:47:27+00:00" + "time": "2021-05-27T09:17:38+00:00" } ], "packages-dev": [], @@ -512,5 +560,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "1.1.0" + "plugin-api-version": "2.1.0" } diff --git a/owa-autoloader.php b/owa-autoloader.php index 36cafb9..303e2ec 100644 --- a/owa-autoloader.php +++ b/owa-autoloader.php @@ -1,11 +1,11 @@ __DIR__ . '/sdk.php', - 'OwaSdk\OwaClient' => __DIR__ . '/OwaClient.php', - 'OwaSdk\Tracker\TrackerClient' => __DIR__ . '/Tracker/TrackerClient.php', - 'OwaSdk\Tracker\State' => __DIR__ . '/Tracker/State.php', - 'OwaSdk\Tracker\TrackingEvent' => __DIR__ . '/Tracker/TrackingEvent.php' + 'OwaSdk\sdk' => __DIR__ . '/src/sdk.php', + 'OwaSdk\OwaClient' => __DIR__ . '/src/OwaClient.php', + 'OwaSdk\Tracker\TrackerClient' => __DIR__ . '/src/Tracker/TrackerClient.php', + 'OwaSdk\Tracker\State' => __DIR__ . '/src/Tracker/State.php', + 'OwaSdk\Tracker\TrackingEvent' => __DIR__ . '/src/Tracker/TrackingEvent.php' ]; @@ -19,7 +19,6 @@ }, true); - require_once( __DIR__ . '/vendor/autoload.php' ); ?> \ No newline at end of file diff --git a/OwaClient.php b/src/OwaClient.php similarity index 100% rename from OwaClient.php rename to src/OwaClient.php diff --git a/Tracker/State.php b/src/Tracker/State.php similarity index 98% rename from Tracker/State.php rename to src/Tracker/State.php index 0cbade8..e4f91aa 100644 --- a/Tracker/State.php +++ b/src/Tracker/State.php @@ -105,7 +105,7 @@ public function get($store, $name = '') { } } - function setState($store, $name = '', $value, $store_type = '', $is_perminent = false) { + function setState($store, $name, $value, $store_type = '', $is_perminent = false) { sdk::debug(sprintf('populating state for store: %s, name: %s, value: %s, store type: %s, is_perm: %s', $store, $name, print_r($value, true), $store_type, $is_perminent)); @@ -153,7 +153,7 @@ function isCdhRequired($store_name) { } } - function set($store, $name = '', $value, $store_type = '', $is_perminent = false) { + function set($store, $name, $value, $store_type = '', $is_perminent = false) { if ( ! isset($this->stores[$store] ) ) { $this->loadState($store); diff --git a/Tracker/TrackerClient.php b/src/Tracker/TrackerClient.php similarity index 99% rename from Tracker/TrackerClient.php rename to src/Tracker/TrackerClient.php index a451f7a..bab3762 100644 --- a/Tracker/TrackerClient.php +++ b/src/Tracker/TrackerClient.php @@ -67,7 +67,7 @@ public function __construct($config = null) { parent::__construct($config); $domain = ''; - + if (array_key_exists( 'cookie_domain', $config) ) { $domain = $config['cookie_domain']; @@ -447,7 +447,7 @@ public function trackPageview($event = '') { return $this->trackEvent($this->pageview_event); } - public function trackAction($action_group = '', $action_name, $action_label = '', $numeric_value = 0) { + public function trackAction($action_name, $action_group = '', $action_label = '', $numeric_value = 0) { $event = $this->makeEvent(); $event->setEventType('track.action'); @@ -1125,7 +1125,7 @@ private function getCurrentUrl() { private function logEvent($event_type, $event) { sdk::debug('implement logEvent method'); - + $conf = [ 'base_uri' => $this->getSetting('instance_url') @@ -1181,4 +1181,4 @@ function getSiteId() { } } -?> \ No newline at end of file +?> diff --git a/Tracker/TrackingEvent.php b/src/Tracker/TrackingEvent.php similarity index 100% rename from Tracker/TrackingEvent.php rename to src/Tracker/TrackingEvent.php diff --git a/data/manifest.php b/src/data/manifest.php similarity index 100% rename from data/manifest.php rename to src/data/manifest.php diff --git a/sdk.php b/src/sdk.php similarity index 100% rename from sdk.php rename to src/sdk.php