From 73f1ba10f9da5ab3664186c22d3be86589cee771 Mon Sep 17 00:00:00 2001 From: slawkens Date: Tue, 27 Oct 2020 07:34:05 +0100 Subject: [PATCH] Use composer for some libraries (twig, phpmailer, semver) --- .gitignore | 4 ++++ common.php | 9 ++++++++- composer.json | 7 +++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 composer.json diff --git a/.gitignore b/.gitignore index af74f1e7..eaf66084 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,10 @@ Thumbs.db .idea tmp +# composer +composer.lock +vendor + releases config.local.php PERSONAL_NOTES diff --git a/common.php b/common.php index a97a6be5..415c3d1e 100644 --- a/common.php +++ b/common.php @@ -67,6 +67,7 @@ define('PAGES', SYSTEM . 'pages/'); define('PLUGINS', BASE . 'plugins/'); define('TEMPLATES', BASE . 'templates/'); define('TOOLS', BASE . 'tools/'); +define('VENDOR', BASE . 'vendor/'); // menu categories define('MENU_CATEGORY_NEWS', 1); @@ -115,4 +116,10 @@ if(!IS_CLI) { require SYSTEM . 'exception.php'; } -require SYSTEM . 'autoload.php'; + +$autoloadFile = VENDOR . 'autoload.php'; +if (!is_file($autoloadFile)) { + throw new RuntimeException('The vendor folder is missing. Please download Composer: https://getcomposer.org/download, install it and execute in the main MyAAC directory this command: composer install. Or download MyAAC from GitHub releases, which includes Vendor folder.'); +} + +require $autoloadFile; diff --git a/composer.json b/composer.json new file mode 100644 index 00000000..d91b02ee --- /dev/null +++ b/composer.json @@ -0,0 +1,7 @@ +{ + "require": { + "phpmailer/phpmailer": "^6.1", + "composer/semver": "^3.2", + "twig/twig": "~1.42.5" + } +}