Closed NotionCommotion closed 5 years ago
Yeah it's worth using but you certainly don't have to. You can see how we consume the .env configuration here: https://github.com/concrete5/composer/blob/master/public/application/config/live.database.php
Also, did you have to make many changes to the concrete5 source code to allow it to be installed with composer?
We don't make any sort of code changes at all, the concrete5/concrete5-core repository should always just be a clone of the main repo's /concrete
directory.
Thanks Korvin,
Yes, I would prefer using it and will do so.
And yes, I now see how the main concrete repo is identical which I think is a good thing. It was how the application is different that confused me.
composer
<?php
defined('C5_EXECUTE') or die('Access Denied.');
# Load in the composer vendor files
require_once __DIR__ . "/../../../vendor/autoload.php";
# Try loading in environment info
$env = new \Dotenv\Dotenv(__DIR__ . '/../../../');
try {
$env->overload();
} catch (\Exception $e) {
// Ignore any errors
}
# Add the vendor directory to the include path
ini_set('include_path', __DIR__ . "/../../../vendor" . PATH_SEPARATOR . get_include_path());
stock
<?php defined('C5_EXECUTE') or die('Access Denied.');
/**
* ----------------------------------------------------------------------------
* Load all composer autoload items.
* ----------------------------------------------------------------------------
*/
if (!@include(DIR_BASE_CORE . '/' . DIRNAME_VENDOR . '/autoload.php')) {
die('Third party libraries not installed. Make sure that composer has required libraries in the concrete/ directory.');
}
First of all, thanks for putting this together.
Not an issue but just a question.
I see how the autoloader first attempts to read .env, and how there is a sample .env.dist in the root directory. I first assumed the vanilla concrete5 also used this code, but I then discovered it doesn't.
Do you recommend using it? Also, did you have to make many changes to the concrete5 source code to allow it to be installed with composer?
Thanks