I have installed Kirby 3 using the Composer setup, but I also want to use other php libs installed via Composer and can’t get it to Work.
My folder structure looks like this:
dev
dist
vendor
composer.json
Kirby is installed inside the dist folder using this composer.json content:
{
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"getkirby/cms": "^3.0",
"elasticsearch/elasticsearch": "~6.0",
"aws/aws-sdk-php": "^3.80"
},
"extra": {
"kirby-cms-path": "dist/kirby"
}
}
My Apache web server use the dist folder as root. Kirby works fine with this set up, the problem is when I try to use elasticsearch and aws which is also installed via Composer.
When trying to use:
use Elasticsearch\ClientBuilder;
$esClient = ClientBuilder::create()->setHosts($esHosts)->build();
inside my template I get the error: Class ‘Elasticsearch\ClientBuilder’ not found’.
I guess this is because the vendor folder is outside the dist folder (my web root folder)?
If I move the vendor folder inside dist the whole site breaks.
How can I change my setup to solve this?