Hi - I’m aware some of you like to have the separation of a theme composer.json and a plugins composer.json - however for a variety of reasons we just want to have it in the same root one.
I’ve set up a normal bedrock and sage install to start with that works and activates etc.
Then I start to move the dependencies into the root file by moving…
"roots/sage-lib": "~9.0.1",
"soberwp/controller": "~9.0.0-beta.4"
to the root composer.json
- I then move the PSR-4 mapping so it resembles
"autoload": {
"psr-4": {
"App\\": "web/app/themes/sage/app"
}
},
then run composer update
and for extra piece of mind composer du
The install goes fine - clear the blade cache just incase and refresh. However it then throws this error
Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Class 'App' not found in /Users/owen/Sites/bedrock/web/app/uploads/cache/8bf0f00af53fe2654545f792466d0b5c5e716614.php:2 Stack trace: #0 /Users/owen/Sites/bedrock/vendor/illuminate/view/Engines/PhpEngine.php(43): include() #1 /Users/owen/Sites/bedrock/vendor/illuminate/view/Engines/CompilerEngine.php(59): Illuminate\View\Engines\PhpEngine->evaluatePath('/Users/owen/Sit...', Array) #2 /Users/owen/Sites/bedrock/vendor/illuminate/view/View.php(142): Illuminate\View\Engines\CompilerEngine->get('/Users/owen/Sit...', Array) #3 /Users/owen/Sites/bedrock/vendor/illuminate/view/View.php(125): Illuminate\View\View->getContents() #4 /Users/owen/Sites/bedrock/vendor/illuminate/view/View.php(90): Illuminate\View\View->renderContents() #5 /Users/owen/Sites/bedrock/web/app/uploads/cache/3679ea20f9f1d3f1e5da4f14237a149a92ed3790.php(2): Illuminate\View\View->render() #6 /Users/owen/Sites/bedrock/vendor/illuminate/view/Engines/PhpEngine.php(43): include('/Users/owe in /Users/owen/Sites/bedrock/web/app/uploads/cache/8bf0f00af53fe2654545f792466d0b5c5e716614.php on line 2
It comes across like it’s not autoloading things correctly.
Below are the main configs from the composer.json
{
"config": {
"preferred-install": "dist"
},
"repositories": [
{
"type": "composer",
"url": "https://wpackagist.org"
}
],
"require": {
"php": ">=7.0",
"composer/installers": "^1.4",
"vlucas/phpdotenv": "^2.0.1",
"johnpbloch/wordpress": "4.*",
"oscarotero/env": "^1.1.0",
"roots/wp-password-bcrypt": "1.0.0",
"roots/sage-lib": "~9.0.1",
"soberwp/controller": "~9.0.0-beta.4"
},
"extra": {
"installer-paths": {
"web/app/mu-plugins/{$name}/": [
"type:wordpress-muplugin"
],
"web/app/plugins/{$name}/": [
"type:wordpress-plugin"
],
"web/app/themes/{$name}/": [
"type:wordpress-theme"
]
},
"wordpress-install-dir": "web/wp"
},
"autoload": {
"psr-4": {
"App\\": "web/app/themes/sage/app"
}
}
}
– Are you guys able to see whats going wrong? or able to provide some information how to hook this up properly?
Thanks