From cf1610dfa1aab15c911157c5469e8d6013425ed6 Mon Sep 17 00:00:00 2001 From: magdev Date: Wed, 6 Aug 2025 10:23:34 +0200 Subject: [PATCH] use local version of listmonk-php --- .editorconfig | 18 + composer.json | 59 +- composer.lock | 30 +- listmonk.php | 63 +- vendor/adnanhussainturki/listmonk-php | 1 + .../adnanhussainturki/listmonk-php/.gitignore | 2 - .../listmonk-php/composer.json | 21 - .../listmonk-php/composer.lock | 615 ------------------ .../adnanhussainturki/listmonk-php/readme.md | 135 ---- .../src/Controllers/ListsController.php | 67 -- .../src/Controllers/SubscribersController.php | 81 --- .../listmonk-php/src/ListMonk.php | 68 -- .../listmonk-php/src/Models/MonkList.php | 126 ---- .../src/Models/MonkSubscriber.php | 126 ---- .../listmonk-php/test/.credentials.example | 5 - .../listmonk-php/test/init.php | 20 - .../listmonk-php/test/list.test.php | 42 -- .../listmonk-php/test/subscriber.test.php | 41 -- vendor/autoload.php | 5 +- vendor/composer/InstalledVersions.php | 45 +- vendor/composer/installed.json | 24 +- vendor/composer/installed.php | 6 +- vendor/composer/platform_check.php | 5 +- 23 files changed, 155 insertions(+), 1450 deletions(-) create mode 100644 .editorconfig create mode 120000 vendor/adnanhussainturki/listmonk-php delete mode 100644 vendor/adnanhussainturki/listmonk-php/.gitignore delete mode 100644 vendor/adnanhussainturki/listmonk-php/composer.json delete mode 100644 vendor/adnanhussainturki/listmonk-php/composer.lock delete mode 100644 vendor/adnanhussainturki/listmonk-php/readme.md delete mode 100644 vendor/adnanhussainturki/listmonk-php/src/Controllers/ListsController.php delete mode 100644 vendor/adnanhussainturki/listmonk-php/src/Controllers/SubscribersController.php delete mode 100644 vendor/adnanhussainturki/listmonk-php/src/ListMonk.php delete mode 100644 vendor/adnanhussainturki/listmonk-php/src/Models/MonkList.php delete mode 100644 vendor/adnanhussainturki/listmonk-php/src/Models/MonkSubscriber.php delete mode 100644 vendor/adnanhussainturki/listmonk-php/test/.credentials.example delete mode 100644 vendor/adnanhussainturki/listmonk-php/test/init.php delete mode 100644 vendor/adnanhussainturki/listmonk-php/test/list.test.php delete mode 100644 vendor/adnanhussainturki/listmonk-php/test/subscriber.test.php diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..1e871ef --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[composer.*] +indent_size = 4 + +[*.php] +indent_size = 4 diff --git a/composer.json b/composer.json index ee5ed3f..294c9d8 100644 --- a/composer.json +++ b/composer.json @@ -1,26 +1,39 @@ { - "name": "magdev/listmonk", - "type": "grav-plugin", - "description": "Listmonk integration for GravCMS", - "version": "1.0.0", - "keywords": ["plugin"], - "homepage": "https://github.com/magdev/grav-plugin-listmonk", - "license": "MIT", - "authors": [ - { - "name": "magdev", - "email": "magdev3.0@gmail.com", - "role": "Developer" - } - ], - "require": { - "php": ">=7.1.3", - "adnanhussainturki/listmonk-php": "^0.1.0" - }, - "autoload": { - "psr-4": { - "Grav\\Plugin\\Listmonk\\": "classes/" + "name": "magdev/listmonk", + "type": "grav-plugin", + "description": "Listmonk integration for GravCMS", + "version": "1.0.0", + "keywords": [ + "plugin" + ], + "homepage": "https://github.com/magdev/grav-plugin-listmonk", + "license": "MIT", + "authors": [ + { + "name": "magdev", + "email": "magdev3.0@gmail.com", + "role": "Developer" + } + ], + "require": { + "php": ">=7.1.3", + "adnanhussainturki/listmonk-php": "dev-main" }, - "classmap": ["listmonk.php"] - } + "autoload": { + "psr-4": { + "Grav\\Plugin\\Listmonk\\": "classes/" + }, + "classmap": [ + "listmonk.php" + ] + }, + "repositories": [ + { + "type": "path", + "url": "/home/magdev/workspaces/php/listmonk-php", + "options": { + "symlink": false + } + } + ] } diff --git a/composer.lock b/composer.lock index 3555bd4..7004a80 100644 --- a/composer.lock +++ b/composer.lock @@ -4,21 +4,15 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "333d17d221a58a8d822b5000f41c697f", + "content-hash": "096d3c9059b402b96784b2897ab5dba7", "packages": [ { "name": "adnanhussainturki/listmonk-php", - "version": "0.1", - "source": { - "type": "git", - "url": "https://github.com/AdnanHussainTurki/listmonk-php.git", - "reference": "0d43700377dfe5eac43f4f6751e83b42e85b5400" - }, + "version": "dev-main", "dist": { - "type": "zip", - "url": "https://api.github.com/repos/AdnanHussainTurki/listmonk-php/zipball/0d43700377dfe5eac43f4f6751e83b42e85b5400", - "reference": "0d43700377dfe5eac43f4f6751e83b42e85b5400", - "shasum": "" + "type": "path", + "url": "/home/magdev/workspaces/php/listmonk-php", + "reference": "13ece3885c574ccab39cdbe711ff0cfda408b561" }, "require": { "guzzlehttp/guzzle": "^7.8" @@ -29,7 +23,6 @@ "AdnanHussainTurki\\ListMonk\\": "src/" } }, - "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -40,11 +33,10 @@ } ], "description": "Package aims to ease up the API calls to a listmonk API from PHP based application", - "support": { - "issues": "https://github.com/AdnanHussainTurki/listmonk-php/issues", - "source": "https://github.com/AdnanHussainTurki/listmonk-php/tree/0.1" - }, - "time": "2023-11-12T00:45:46+00:00" + "transport-options": { + "symlink": false, + "relative": false + } }, { "name": "guzzlehttp/guzzle", @@ -646,7 +638,9 @@ "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": { + "adnanhussainturki/listmonk-php": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/listmonk.php b/listmonk.php index 6665060..0ea1107 100644 --- a/listmonk.php +++ b/listmonk.php @@ -8,7 +8,6 @@ use Grav\Common\Data\Data; use Grav\Common\Plugin; use Grav\Plugin\Form\Form; use Grav\Plugin\Listmonk\Exceptions\ListmonkClientException; -use Grav\Plugin\Listmonk\Exceptions\ListmonkException; use RocketTheme\Toolbox\Event\Event; use ValueError; @@ -83,14 +82,15 @@ class ListmonkPlugin extends Plugin $this->processNewsletterForm($event, $form, $this->getParams($form, $params)); break; - #case 'listmonk': - # $this->processForm($event, $form, $this->getParams($form, $params)); - # break; - }# + case 'listmonk_transactional': + $this->processTransactionalForm($event, $form, $this->getParams($form, $params)); + break; + } + $event->stopPropagation(); } /** - * Process `listmonk_newsletter` form action + * Store a newsletter subscriber in listmonk * * @param Event $event * @return void @@ -125,10 +125,36 @@ class ListmonkPlugin extends Plugin 'form' => $form, 'message' => $this->parseMessage($e->getMessage()) ])); - $event->stopPropagation(); } } + /** + * Send a transactional mail using listmonk + * + * (Not implemented yet!) + * + * @param Event $event + * @return void + */ + private function processTransactionalForm(Event $event, Form $form, array $params): void + { + $this->grav->fireEvent('onFormValidationError', new Event([ + 'form' => $form, + 'message' => 'Sending transactional emails is not implemented yet', + ])); + + #try { + # $client = $this->getListmonkClient(); + #} catch (ListmonkClientException $e) { + # $this->grav->fireEvent('onFormValidationError', new Event([ + # 'form' => $form, + # 'message' => $e->getMessage(), + # ])); + #} catch (ListmonkException $e) { + # throw new \RuntimeException('Error while processing form', -1, $e); + #} + } + private function processAttributes(array $attributes): array { $globals = $this->config->get('plugins.listmonk.newsletter.subscriber.attributes'); @@ -160,29 +186,6 @@ class ListmonkPlugin extends Plugin } } - /** - * Process `listmonk` form action - * - * @param Event $event - * @return void - */ - private function processForm(Event $event, Form $form, array $params): void - { - try { - $client = $this->getListmonkClient(); - - } catch (ListmonkClientException $e) { - $this->grav->fireEvent('onFormValidationError', new Event([ - 'form' => $form, - 'message' => $e->getMessage() - ])); - $event->stopPropagation(); - } catch (ListmonkException $e) { - $event->stopPropagation(); - throw new \RuntimeException('Error while processing form', -1, $e); - } - } - private function getListmonkClient(): ListMonk { if ($this->client instanceof ListMonk) { diff --git a/vendor/adnanhussainturki/listmonk-php b/vendor/adnanhussainturki/listmonk-php new file mode 120000 index 0000000..ff4a719 --- /dev/null +++ b/vendor/adnanhussainturki/listmonk-php @@ -0,0 +1 @@ +/home/magdev/workspaces/php/listmonk-php/ \ No newline at end of file diff --git a/vendor/adnanhussainturki/listmonk-php/.gitignore b/vendor/adnanhussainturki/listmonk-php/.gitignore deleted file mode 100644 index c78d6b4..0000000 --- a/vendor/adnanhussainturki/listmonk-php/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -vendor -test/.credentials \ No newline at end of file diff --git a/vendor/adnanhussainturki/listmonk-php/composer.json b/vendor/adnanhussainturki/listmonk-php/composer.json deleted file mode 100644 index 30bafcc..0000000 --- a/vendor/adnanhussainturki/listmonk-php/composer.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "adnanhussainturki/listmonk-php", - "description": "Package aims to ease up the API calls to a listmonk API from PHP based application", - "type": "library", - "require": { - "guzzlehttp/guzzle": "^7.8" - }, - "license": "MIT", - "autoload": { - "psr-4": { - "AdnanHussainTurki\\ListMonk\\": "src/" - } - }, - "authors": [ - { - "name": "Adnan Hussain Turki", - "email": "adnanhussainturki@gmail.com" - } - ], - "minimum-stability": "stable" -} diff --git a/vendor/adnanhussainturki/listmonk-php/composer.lock b/vendor/adnanhussainturki/listmonk-php/composer.lock deleted file mode 100644 index c25bb50..0000000 --- a/vendor/adnanhussainturki/listmonk-php/composer.lock +++ /dev/null @@ -1,615 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "6467066da8a0b5c7d46cd8ced7c64571", - "packages": [ - { - "name": "guzzlehttp/guzzle", - "version": "7.8.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "1110f66a6530a40fe7aea0378fe608ee2b2248f9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/1110f66a6530a40fe7aea0378fe608ee2b2248f9", - "reference": "1110f66a6530a40fe7aea0378fe608ee2b2248f9", - "shasum": "" - }, - "require": { - "ext-json": "*", - "guzzlehttp/promises": "^1.5.3 || ^2.0.1", - "guzzlehttp/psr7": "^1.9.1 || ^2.5.1", - "php": "^7.2.5 || ^8.0", - "psr/http-client": "^1.0", - "symfony/deprecation-contracts": "^2.2 || ^3.0" - }, - "provide": { - "psr/http-client-implementation": "1.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.1", - "ext-curl": "*", - "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", - "php-http/message-factory": "^1.1", - "phpunit/phpunit": "^8.5.29 || ^9.5.23", - "psr/log": "^1.1 || ^2.0 || ^3.0" - }, - "suggest": { - "ext-curl": "Required for CURL handler support", - "ext-intl": "Required for Internationalized Domain Name (IDN) support", - "psr/log": "Required for using the Log middleware" - }, - "type": "library", - "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": false - } - }, - "autoload": { - "files": [ - "src/functions_include.php" - ], - "psr-4": { - "GuzzleHttp\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Jeremy Lindblom", - "email": "jeremeamia@gmail.com", - "homepage": "https://github.com/jeremeamia" - }, - { - "name": "George Mponos", - "email": "gmponos@gmail.com", - "homepage": "https://github.com/gmponos" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/Nyholm" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://github.com/sagikazarmark" - }, - { - "name": "Tobias Schultze", - "email": "webmaster@tubo-world.de", - "homepage": "https://github.com/Tobion" - } - ], - "description": "Guzzle is a PHP HTTP client library", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "psr-18", - "psr-7", - "rest", - "web service" - ], - "support": { - "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.8.0" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://github.com/Nyholm", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", - "type": "tidelift" - } - ], - "time": "2023-08-27T10:20:53+00:00" - }, - { - "name": "guzzlehttp/promises", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/guzzle/promises.git", - "reference": "111166291a0f8130081195ac4556a5587d7f1b5d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/111166291a0f8130081195ac4556a5587d7f1b5d", - "reference": "111166291a0f8130081195ac4556a5587d7f1b5d", - "shasum": "" - }, - "require": { - "php": "^7.2.5 || ^8.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.1", - "phpunit/phpunit": "^8.5.29 || ^9.5.23" - }, - "type": "library", - "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": false - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/Nyholm" - }, - { - "name": "Tobias Schultze", - "email": "webmaster@tubo-world.de", - "homepage": "https://github.com/Tobion" - } - ], - "description": "Guzzle promises library", - "keywords": [ - "promise" - ], - "support": { - "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.0.1" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://github.com/Nyholm", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", - "type": "tidelift" - } - ], - "time": "2023-08-03T15:11:55+00:00" - }, - { - "name": "guzzlehttp/psr7", - "version": "2.6.1", - "source": { - "type": "git", - "url": "https://github.com/guzzle/psr7.git", - "reference": "be45764272e8873c72dbe3d2edcfdfcc3bc9f727" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/be45764272e8873c72dbe3d2edcfdfcc3bc9f727", - "reference": "be45764272e8873c72dbe3d2edcfdfcc3bc9f727", - "shasum": "" - }, - "require": { - "php": "^7.2.5 || ^8.0", - "psr/http-factory": "^1.0", - "psr/http-message": "^1.1 || ^2.0", - "ralouphie/getallheaders": "^3.0" - }, - "provide": { - "psr/http-factory-implementation": "1.0", - "psr/http-message-implementation": "1.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.1", - "http-interop/http-factory-tests": "^0.9", - "phpunit/phpunit": "^8.5.29 || ^9.5.23" - }, - "suggest": { - "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" - }, - "type": "library", - "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": false - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "George Mponos", - "email": "gmponos@gmail.com", - "homepage": "https://github.com/gmponos" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/Nyholm" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://github.com/sagikazarmark" - }, - { - "name": "Tobias Schultze", - "email": "webmaster@tubo-world.de", - "homepage": "https://github.com/Tobion" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://sagikazarmark.hu" - } - ], - "description": "PSR-7 message implementation that also provides common utility methods", - "keywords": [ - "http", - "message", - "psr-7", - "request", - "response", - "stream", - "uri", - "url" - ], - "support": { - "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.6.1" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://github.com/Nyholm", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", - "type": "tidelift" - } - ], - "time": "2023-08-27T10:13:57+00:00" - }, - { - "name": "psr/http-client", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-client.git", - "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", - "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", - "shasum": "" - }, - "require": { - "php": "^7.0 || ^8.0", - "psr/http-message": "^1.0 || ^2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Client\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP clients", - "homepage": "https://github.com/php-fig/http-client", - "keywords": [ - "http", - "http-client", - "psr", - "psr-18" - ], - "support": { - "source": "https://github.com/php-fig/http-client" - }, - "time": "2023-09-23T14:17:50+00:00" - }, - { - "name": "psr/http-factory", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-factory.git", - "reference": "e616d01114759c4c489f93b099585439f795fe35" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", - "reference": "e616d01114759c4c489f93b099585439f795fe35", - "shasum": "" - }, - "require": { - "php": ">=7.0.0", - "psr/http-message": "^1.0 || ^2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interfaces for PSR-7 HTTP message factories", - "keywords": [ - "factory", - "http", - "message", - "psr", - "psr-17", - "psr-7", - "request", - "response" - ], - "support": { - "source": "https://github.com/php-fig/http-factory/tree/1.0.2" - }, - "time": "2023-04-10T20:10:41+00:00" - }, - { - "name": "psr/http-message", - "version": "2.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", - "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP messages", - "homepage": "https://github.com/php-fig/http-message", - "keywords": [ - "http", - "http-message", - "psr", - "psr-7", - "request", - "response" - ], - "support": { - "source": "https://github.com/php-fig/http-message/tree/2.0" - }, - "time": "2023-04-04T09:54:51+00:00" - }, - { - "name": "ralouphie/getallheaders", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/ralouphie/getallheaders.git", - "reference": "120b605dfeb996808c31b6477290a714d356e822" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", - "reference": "120b605dfeb996808c31b6477290a714d356e822", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "php-coveralls/php-coveralls": "^2.1", - "phpunit/phpunit": "^5 || ^6.5" - }, - "type": "library", - "autoload": { - "files": [ - "src/getallheaders.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ralph Khattar", - "email": "ralph.khattar@gmail.com" - } - ], - "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/deprecation-contracts", - "version": "v3.3.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "files": [ - "function.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2023-05-23T14:45:45+00:00" - } - ], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [], - "plugin-api-version": "2.6.0" -} diff --git a/vendor/adnanhussainturki/listmonk-php/readme.md b/vendor/adnanhussainturki/listmonk-php/readme.md deleted file mode 100644 index 7df1d48..0000000 --- a/vendor/adnanhussainturki/listmonk-php/readme.md +++ /dev/null @@ -1,135 +0,0 @@ -# ListMonk - PHP -The package allows easy access to ListMonk API from PHP based applications. - - -### Installation -You can install this library to your project via composer using the following command: - -`composer require adnanhussainturki/listmonk-php` - -### Usage - - -``` - -``` - -### Managing lists -```php - -// Get all lists -$lists = $listMonk->lists()->getAll(); -echo "All lists:\n"; -foreach ($lists as $list) { - echo $list->getId() . " - " . $list->getName() . "\n"; -} - -// Get a list by id -$list = $listMonk->lists()->get(3); -echo "List with id 3:\n"; -echo $list->getId() . " - " . $list->getName() . "\n"; - -// Create a new list -$newList = new \AdnanHussainTurki\ListMonk\Models\MonkList(); -$newList->setName("Test List"); -$newList->setType("private"); -$newList->setOptin("single"); -$newList->setTags(["test", "list"]); -$newListMonk = $listMonk->lists()->create($newList); -echo "New list created:\n"; -echo $newListMonk->getId(). " - " . $newListMonk->getName() . "\n"; - - -// Update the created list -$newListMonk->setName("Test List Updated"); -$newListMonk->setType("public"); -$newListMonk->setOptin("double"); -$newListMonk->setTags(["test", "list", "updated"]); -$updatedList = $listMonk->lists()->update($newListMonk); -echo "Updated list:\n"; -echo $updatedList->getId(). " - " . $updatedList->getName() . "\n"; - - -// Delete the created list -$deletedList = $listMonk->lists()->delete($updatedList->getId()); -echo "List deleted:\n"; -echo $deletedList->getId(). " - " . $deletedList->getName() . "\n"; - - -``` - -### Managing subscribers -```php -subscribers()->getAll(); -echo "All subscribers:\n"; -foreach ($subscribers as $subscriber) { - echo $subscriber->getId() . " - " . $subscriber->getName() . "\n"; -} - -// Get a subscriber by id -$subscriber = $listMonk->subscribers()->get(5); -echo "Subscriber with id 1:\n"; -echo $subscriber->getId() . " - " . $subscriber->getName() . "\n"; - -// Create a new subscriber -$newSubscriber = new \AdnanHussainTurki\ListMonk\Models\MonkSubscriber(); -$newSubscriber->setName("Test Subscriber"); -$newSubscriber->setEmail(random_int(23, 1000). "@gmail.com"); -$newSubscriber->setStatus("enabled"); -$newSubscriber->setLists([1, 2]); - -$newSubscriberMonk = $listMonk->subscribers()->create($newSubscriber); -echo "New subscriber created:\n"; -echo $newSubscriberMonk->getId(). " - " . $newSubscriberMonk->getName() . "\n"; - -// Update the created subscriber -$newSubscriberMonk->setName("Test Subscriber Updated"); -$newSubscriberMonk->setEmail(random_int(23, 1000). "@email.com"); -$newSubscriberMonk->setStatus("disabled"); -$newSubscriberMonk->setLists([1, 2, 3]); -$updatedSubscriber = $listMonk->subscribers()->update($newSubscriberMonk); -echo "Updated subscriber:\n"; -echo $updatedSubscriber->getId(). " - " . $updatedSubscriber->getName() . "\n"; - -// Delete the created subscriber -$deletedSubscriber = $listMonk->subscribers()->delete($updatedSubscriber->getId()); -echo "Subscriber deleted:\n"; -echo $deletedSubscriber->getId(). " - " . $deletedSubscriber->getName() . "\n"; - -``` - - -### Whats more to be done? -- All routes of `Subscriber` is not yet handled. -- `Campaign` needs to be implemented. -- `Media` needs to be implemented. -- `Import` needs to be implemented. -- `Template` needs to be implemented. -- `Transactional` needs to be implemented. - - -### Buy me a coffee -[![](https://img.buymeacoffee.com/api/?url=aHR0cHM6Ly9pbWcuYnV5bWVhY29mZmVlLmNvbS9hcGkvP25hbWU9YWRuYW50dXJraSZzaXplPTMwMCZiZy1pbWFnZT1ibWMmYmFja2dyb3VuZD1mZjgxM2Y=&creator=adnanturki&is_creating=building%20cool%20things%20every%20single%20f**king%20day.&design_code=1&design_color=%23ff813f&slug=adnanturki)](https://www.buymeacoffee.com/adnanturki) - -### How to contribute -- Create a fork, make changes and send a pull request. -- Raise a issue - -### License -Licensed under Apache 2.0. You can check its details [here](https://choosealicense.com/licenses/apache-2.0/ "here"). diff --git a/vendor/adnanhussainturki/listmonk-php/src/Controllers/ListsController.php b/vendor/adnanhussainturki/listmonk-php/src/Controllers/ListsController.php deleted file mode 100644 index 2419902..0000000 --- a/vendor/adnanhussainturki/listmonk-php/src/Controllers/ListsController.php +++ /dev/null @@ -1,67 +0,0 @@ -listMonk = $listMonk; - } - - function getAll($page=1, $perPage=100) : array - { - $response = $this->listMonk->http('/api/lists' . '?page=' . $page . '&per_page=' . $perPage); - $lists = json_decode($response)->data->results; - $listObjects = []; - foreach ($lists as $key => $list) { - $listObjects[$key] = new MonkList($list); - } - return $listObjects; - } - - function get($id) { - $response = $this->listMonk->http('/api/lists/' . $id); - return new MonkList(json_decode($response)->data); - } - - function create(MonkList $list) { - $response = $this->listMonk->http('/api/lists', 'post', [ - 'name' => $list->getName(), - 'type' => $list->getType(), - 'optin' => $list->getOptin(), - 'tags' => $list->getTags() - ]); - return new MonkList(json_decode($response)->data); - } - - function update(MonkList $list) { - if ($list->getId() == null) throw new \Exception("List id is required"); - $response = $this->listMonk->http('/api/lists/' . $list->getId(), 'put', [ - 'list_id' => $list->getId(), - 'name' => $list->getName(), - 'type' => $list->getType(), - 'optin' => $list->getOptin(), - 'tags' => $list->getTags() - ]); - return new MonkList(json_decode($response)->data); - } - - function delete($id) { - $stored = $this->get($id); - if ($stored == null) throw new \Exception("List not found"); - $response = $this->listMonk->http('/api/lists/' . $id, 'delete'); - try { - $this->get($id); - - } catch (\Throwable $th) { - return $stored; - } - throw new \Exception("List not deleted"); - } - -} \ No newline at end of file diff --git a/vendor/adnanhussainturki/listmonk-php/src/Controllers/SubscribersController.php b/vendor/adnanhussainturki/listmonk-php/src/Controllers/SubscribersController.php deleted file mode 100644 index e86c187..0000000 --- a/vendor/adnanhussainturki/listmonk-php/src/Controllers/SubscribersController.php +++ /dev/null @@ -1,81 +0,0 @@ -listMonk = $listMonk; - } - function getAll($page=1, $perPage=100) : array - { - $response = $this->listMonk->http('/api/subscribers' . '?page=' . $page . '&per_page=' . $perPage); - $subscribers = json_decode($response)->data->results; - $subscriberObjects = []; - foreach ($subscribers as $key => $subscriber) { - $subscriberObjects[$key] = new MonkSubscriber($subscriber); - } - return $subscriberObjects; - } - - function get($id) { - $response = $this->listMonk->http('/api/subscribers/' . $id); - return new MonkSubscriber(json_decode($response)->data); - } - - function create(MonkSubscriber $subscriber, $preConfirm = false) { - $data = [ - 'name' => $subscriber->getName(), - 'email' => $subscriber->getEmail(), - 'status' => $subscriber->getStatus(), - 'lists' => $subscriber->getLists(), - 'preconfirm_subscriptions' => $preConfirm - ]; - if ($subscriber->getAttribs() != null) { - $data['attribs'] = $subscriber->getAttribs(); - } - try { - $response = $this->listMonk->http('/api/subscribers', 'post', $data); - } catch (ClientException $th) { - throw new \Exception($th->getResponse()->getBody()->getContents()); - } - - return new MonkSubscriber(json_decode($response)->data); - } - - function modifyLists($subscriber_ids, $action, $target_list_ids, $status = null) { - if (!in_array($action, ["add", "remove", "unsubscribe"])) throw new \Exception("Invalid action, allowed actions are: add, remove, unsubscribe."); - if ($action == "add") { - if (!in_array($status, ["confirmed", "unsubscribed", "unconfirmed"])) throw new \Exception("Invalid status, allowed status are: subscribed, unsubscribed, unconfirmed."); - } - return $this->listMonk->http('/api/subscribers/lists', 'put', [ - 'ids' => $subscriber_ids, - 'action' => $action, - 'target_list_ids' => $target_list_ids, - 'status' => $status - ]); - } - function update(MonkSubscriber $subscriber) { - if ($subscriber->getId() == null) throw new \Exception("Subscriber id is required"); - $response = $this->listMonk->http('/api/subscribers/' . $subscriber->getId(), 'put', $subscriber->toArray()); - return new MonkSubscriber(json_decode($response)->data); - } - - function delete($id) { - $stored = $this->get($id); - if ($stored == null) throw new \Exception("Subscriber not found"); - $response = $this->listMonk->http('/api/subscribers/' . $id, 'delete'); - try { - $this->get($id); - - } catch (\Throwable $th) { - return $stored; - } - throw new \Exception("Subscriber not deleted"); - } -} \ No newline at end of file diff --git a/vendor/adnanhussainturki/listmonk-php/src/ListMonk.php b/vendor/adnanhussainturki/listmonk-php/src/ListMonk.php deleted file mode 100644 index 81479af..0000000 --- a/vendor/adnanhussainturki/listmonk-php/src/ListMonk.php +++ /dev/null @@ -1,68 +0,0 @@ -serverUrl = $serverUrl; - $this->username = $username; - $this->password = $password; - } - - public function lists() - { - $this->listsController = new ListsController($this); - return $this->listsController; - } - - public function subscribers() - { - $this->subscribersController = new SubscribersController($this); - return $this->subscribersController; - } - - public function getServerUrl() - { - return $this->serverUrl; - } - - public function getUsername() - { - return $this->username; - } - - public function getPassword() - { - return $this->password; - } - - public function http($path, $method = "get", $data = []) - { - $client = new Client(); - $headers = [ - 'Authorization' => 'Basic ' . base64_encode($this->username . ":" . $this->password) - ]; - if (strtolower($method) == "get") { - $request = new Request(strtoupper($method), $this->serverUrl . $path, $headers); - } else { - $headers['Content-Type'] = 'application/json'; - $request = new Request(strtoupper($method), $this->serverUrl . $path, $headers, json_encode($data)); - } - $res = $client->sendAsync($request)->wait(); - return $res->getBody(); - } -} diff --git a/vendor/adnanhussainturki/listmonk-php/src/Models/MonkList.php b/vendor/adnanhussainturki/listmonk-php/src/Models/MonkList.php deleted file mode 100644 index b00bb28..0000000 --- a/vendor/adnanhussainturki/listmonk-php/src/Models/MonkList.php +++ /dev/null @@ -1,126 +0,0 @@ -id = $list->id; - $this->created_at = $list->created_at; - $this->updated_at = $list->updated_at; - $this->uuid = $list->uuid; - $this->name = $list->name; - $this->type = $list->type; - $this->optin = $list->optin; - $this->tags = $list->tags; - $this->subscriber_count = $list->subscriber_count; - } - - public function getId() { - return $this->id; - } - - public function setId($id) { - $this->id = $id; - } - - public function getCreatedAt() { - return $this->created_at; - } - - public function setCreatedAt($createdAt) { - $this->created_at = $createdAt; - } - - public function getUpdatedAt() { - return $this->updated_at; - } - - public function setUpdatedAt($updatedAt) { - $this->updated_at = $updatedAt; - } - - public function getUuid() { - return $this->uuid; - } - - public function setUuid($uuid) { - $this->uuid = $uuid; - } - - public function getName() { - return $this->name; - } - - public function setName($name) { - $this->name = $name; - } - - public function getType() { - return $this->type; - } - - public function setType($type) { - if (!in_array($type, $this->allowed_types)) { - throw new \Exception("Invalid list type. Allowed types are: " . implode(", ", $this->allowed_types)); - } - $this->type = $type; - } - - public function getOptin() { - return $this->optin; - } - - public function setOptin($optin) { - if (!in_array($optin, $this->allowed_options)) { - throw new \Exception("Invalid optin type. Allowed types are: " . implode(", ", $this->allowed_options)); - } - $this->optin = $optin; - } - - public function getTags() { - return $this->tags; - } - - public function setTags($tags) { - $this->tags = $tags; - } - - public function getSubscriberCount() { - return $this->subscriber_count; - } - - public function setSubscriberCount($subscriber_count) { - $this->subscriber_count = $subscriber_count; - } - - public function toArray() { - return [ - 'id' => $this->id, - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, - 'uuid' => $this->uuid, - 'name' => $this->name, - 'type' => $this->type, - 'optin' => $this->optin, - 'tags' => $this->tags, - 'subscriber_count' => $this->subscriber_count - ]; - } - -} - - -?> diff --git a/vendor/adnanhussainturki/listmonk-php/src/Models/MonkSubscriber.php b/vendor/adnanhussainturki/listmonk-php/src/Models/MonkSubscriber.php deleted file mode 100644 index fe74bde..0000000 --- a/vendor/adnanhussainturki/listmonk-php/src/Models/MonkSubscriber.php +++ /dev/null @@ -1,126 +0,0 @@ -id = $subscriber->id; - $this->created_at = $subscriber->created_at; - $this->updated_at = $subscriber->updated_at; - $this->uuid = $subscriber->uuid; - $this->email = $subscriber->email; - $this->name = $subscriber->name; - $this->attribs = $subscriber->attribs; - $this->status = $subscriber->status; - $this->lists = $subscriber->lists; - } - - public function getId() { - return $this->id; - } - - public function setId($id) { - $this->id = $id; - } - - public function getCreatedAt() { - return $this->created_at; - } - - public function setCreatedAt($createdAt) { - $this->created_at = $createdAt; - } - - public function getUpdatedAt() { - return $this->updated_at; - } - - public function setUpdatedAt($updatedAt) { - $this->updated_at = $updatedAt; - } - - public function getUuid() { - return $this->uuid; - } - - public function setUuid($uuid) { - $this->uuid = $uuid; - } - - public function getEmail() { - return $this->email; - } - - public function setEmail($email) { - $this->email= $email; - } - - public function getName() { - return $this->name; - } - - public function setName($name) { - $this->name= $name; - } - - public function getAttribs() { - return $this->attribs; - } - - public function setAttribs($attribs) { - $this->attribs= $attribs; - } - - public function getStatus() { - return $this->status; - } - - public function setStatus($status) { - if (!in_array($status, $this->allowed_status)) { - throw new \Exception("Invalid status, allowed status are: " . implode(", ", $this->allowed_status) . "."); - } - $this->status= $status; - } - - public function getLists() { - return $this->lists; - } - - public function setLists($lists) { - $this->lists= $lists; - } - - public function toArray() { - return [ - 'id' => $this->id, - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, - 'uuid' => $this->uuid, - 'email' => $this->email, - 'name' => $this->name, - 'attribs' => $this->attribs, - 'status' => $this->status, - 'lists' => $this->lists - ]; - } - - public function toJson() { - return json_encode($this->toArray()); - } - -} \ No newline at end of file diff --git a/vendor/adnanhussainturki/listmonk-php/test/.credentials.example b/vendor/adnanhussainturki/listmonk-php/test/.credentials.example deleted file mode 100644 index bc0b562..0000000 --- a/vendor/adnanhussainturki/listmonk-php/test/.credentials.example +++ /dev/null @@ -1,5 +0,0 @@ -{ - "serverUrl" : "", - "username" : "", - "password" : "" -} \ No newline at end of file diff --git a/vendor/adnanhussainturki/listmonk-php/test/init.php b/vendor/adnanhussainturki/listmonk-php/test/init.php deleted file mode 100644 index 54c64bd..0000000 --- a/vendor/adnanhussainturki/listmonk-php/test/init.php +++ /dev/null @@ -1,20 +0,0 @@ -getMessage(); - exit; -} - -// Create a new ListMonk instance -$listMonk = new \AdnanHussainTurki\ListMonk\ListMonk( - $credentials['serverUrl'], - $credentials['username'], - $credentials['password'] -); - -?> \ No newline at end of file diff --git a/vendor/adnanhussainturki/listmonk-php/test/list.test.php b/vendor/adnanhussainturki/listmonk-php/test/list.test.php deleted file mode 100644 index aad8e3f..0000000 --- a/vendor/adnanhussainturki/listmonk-php/test/list.test.php +++ /dev/null @@ -1,42 +0,0 @@ -lists()->getAll(); -echo "All lists:\n"; -foreach ($lists as $list) { - echo $list->getId() . " - " . $list->getName() . "\n"; -} - -// Get a list by id -$list = $listMonk->lists()->get(3); -echo "List with id 3:\n"; -echo $list->getId() . " - " . $list->getName() . "\n"; - -// Create a new list -$newList = new \AdnanHussainTurki\ListMonk\Models\MonkList(); -$newList->setName("Test List"); -$newList->setType("private"); -$newList->setOptin("single"); -$newList->setTags(["test", "list"]); -$newListMonk = $listMonk->lists()->create($newList); -echo "New list created:\n"; -echo $newListMonk->getId(). " - " . $newListMonk->getName() . "\n"; - - -// Update the created list -$newListMonk->setName("Test List Updated"); -$newListMonk->setType("public"); -$newListMonk->setOptin("double"); -$newListMonk->setTags(["test", "list", "updated"]); -$updatedList = $listMonk->lists()->update($newListMonk); -echo "Updated list:\n"; -echo $updatedList->getId(). " - " . $updatedList->getName() . "\n"; - - -// Delete the created list -$deletedList = $listMonk->lists()->delete($updatedList->getId()); -echo "List deleted:\n"; -echo $deletedList->getId(). " - " . $deletedList->getName() . "\n"; - diff --git a/vendor/adnanhussainturki/listmonk-php/test/subscriber.test.php b/vendor/adnanhussainturki/listmonk-php/test/subscriber.test.php deleted file mode 100644 index 290463e..0000000 --- a/vendor/adnanhussainturki/listmonk-php/test/subscriber.test.php +++ /dev/null @@ -1,41 +0,0 @@ -subscribers()->getAll(); -echo "All subscribers:\n"; -foreach ($subscribers as $subscriber) { - echo $subscriber->getId() . " - " . $subscriber->getName() . "\n"; -} - -// Get a subscriber by id -$subscriber = $listMonk->subscribers()->get(5); -echo "Subscriber with id 1:\n"; -echo $subscriber->getId() . " - " . $subscriber->getName() . "\n"; - -// Create a new subscriber -$newSubscriber = new \AdnanHussainTurki\ListMonk\Models\MonkSubscriber(); -$newSubscriber->setName("Test Subscriber"); -$newSubscriber->setEmail(random_int(23, 1000). "@gmail.com"); -$newSubscriber->setStatus("enabled"); -$newSubscriber->setLists([1, 2]); - -$newSubscriberMonk = $listMonk->subscribers()->create($newSubscriber); -echo "New subscriber created:\n"; -echo $newSubscriberMonk->getId(). " - " . $newSubscriberMonk->getName() . "\n"; - -// Update the created subscriber -$newSubscriberMonk->setName("Test Subscriber Updated"); -$newSubscriberMonk->setEmail(random_int(23, 1000). "@email.com"); -$newSubscriberMonk->setStatus("disabled"); -$newSubscriberMonk->setLists([1, 2, 3]); -$updatedSubscriber = $listMonk->subscribers()->update($newSubscriberMonk); -echo "Updated subscriber:\n"; -echo $updatedSubscriber->getId(). " - " . $updatedSubscriber->getName() . "\n"; - -// Delete the created subscriber -$deletedSubscriber = $listMonk->subscribers()->delete($updatedSubscriber->getId()); -echo "Subscriber deleted:\n"; -echo $deletedSubscriber->getId(). " - " . $deletedSubscriber->getName() . "\n"; - diff --git a/vendor/autoload.php b/vendor/autoload.php index 73df06a..9549dce 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -14,10 +14,7 @@ if (PHP_VERSION_ID < 50600) { echo $err; } } - trigger_error( - $err, - E_USER_ERROR - ); + throw new RuntimeException($err); } require_once __DIR__ . '/composer/autoload_real.php'; diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php index 51e734a..2052022 100644 --- a/vendor/composer/InstalledVersions.php +++ b/vendor/composer/InstalledVersions.php @@ -26,12 +26,23 @@ use Composer\Semver\VersionParser; */ class InstalledVersions { + /** + * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to + * @internal + */ + private static $selfDir = null; + /** * @var mixed[]|null * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null */ private static $installed; + /** + * @var bool + */ + private static $installedIsLocalDir; + /** * @var bool|null */ @@ -309,6 +320,24 @@ class InstalledVersions { self::$installed = $data; self::$installedByVendor = array(); + + // when using reload, we disable the duplicate protection to ensure that self::$installed data is + // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not, + // so we have to assume it does not, and that may result in duplicate data being returned when listing + // all installed packages for example + self::$installedIsLocalDir = false; + } + + /** + * @return string + */ + private static function getSelfDir() + { + if (self::$selfDir === null) { + self::$selfDir = strtr(__DIR__, '\\', '/'); + } + + return self::$selfDir; } /** @@ -322,19 +351,27 @@ class InstalledVersions } $installed = array(); + $copiedLocalDir = false; if (self::$canGetVendors) { + $selfDir = self::getSelfDir(); foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { + $vendorDir = strtr($vendorDir, '\\', '/'); if (isset(self::$installedByVendor[$vendorDir])) { $installed[] = self::$installedByVendor[$vendorDir]; } elseif (is_file($vendorDir.'/composer/installed.php')) { /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ $required = require $vendorDir.'/composer/installed.php'; - $installed[] = self::$installedByVendor[$vendorDir] = $required; - if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { - self::$installed = $installed[count($installed) - 1]; + self::$installedByVendor[$vendorDir] = $required; + $installed[] = $required; + if (self::$installed === null && $vendorDir.'/composer' === $selfDir) { + self::$installed = $required; + self::$installedIsLocalDir = true; } } + if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) { + $copiedLocalDir = true; + } } } @@ -350,7 +387,7 @@ class InstalledVersions } } - if (self::$installed !== array()) { + if (self::$installed !== array() && !$copiedLocalDir) { $installed[] = self::$installed; } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 1ec3b01..0087126 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -2,23 +2,16 @@ "packages": [ { "name": "adnanhussainturki/listmonk-php", - "version": "0.1", - "version_normalized": "0.1.0.0", - "source": { - "type": "git", - "url": "https://github.com/AdnanHussainTurki/listmonk-php.git", - "reference": "0d43700377dfe5eac43f4f6751e83b42e85b5400" - }, + "version": "dev-main", + "version_normalized": "dev-main", "dist": { - "type": "zip", - "url": "https://api.github.com/repos/AdnanHussainTurki/listmonk-php/zipball/0d43700377dfe5eac43f4f6751e83b42e85b5400", - "reference": "0d43700377dfe5eac43f4f6751e83b42e85b5400", - "shasum": "" + "type": "path", + "url": "/home/magdev/workspaces/php/listmonk-php", + "reference": "13ece3885c574ccab39cdbe711ff0cfda408b561" }, "require": { "guzzlehttp/guzzle": "^7.8" }, - "time": "2023-11-12T00:45:46+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -26,7 +19,6 @@ "AdnanHussainTurki\\ListMonk\\": "src/" } }, - "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -37,9 +29,9 @@ } ], "description": "Package aims to ease up the API calls to a listmonk API from PHP based application", - "support": { - "issues": "https://github.com/AdnanHussainTurki/listmonk-php/issues", - "source": "https://github.com/AdnanHussainTurki/listmonk-php/tree/0.1" + "transport-options": { + "symlink": true, + "relative": false }, "install-path": "../adnanhussainturki/listmonk-php" }, diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 254f46f..7f1c989 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -11,9 +11,9 @@ ), 'versions' => array( 'adnanhussainturki/listmonk-php' => array( - 'pretty_version' => '0.1', - 'version' => '0.1.0.0', - 'reference' => '0d43700377dfe5eac43f4f6751e83b42e85b5400', + 'pretty_version' => 'dev-main', + 'version' => 'dev-main', + 'reference' => '13ece3885c574ccab39cdbe711ff0cfda408b561', 'type' => 'library', 'install_path' => __DIR__ . '/../adnanhussainturki/listmonk-php', 'aliases' => array(), diff --git a/vendor/composer/platform_check.php b/vendor/composer/platform_check.php index 4c3a5d6..2beb149 100644 --- a/vendor/composer/platform_check.php +++ b/vendor/composer/platform_check.php @@ -19,8 +19,7 @@ if ($issues) { echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; } } - trigger_error( - 'Composer detected issues in your platform: ' . implode(' ', $issues), - E_USER_ERROR + throw new \RuntimeException( + 'Composer detected issues in your platform: ' . implode(' ', $issues) ); }