Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Class 'App' not found in /Users/redacted/valet/bedrock/web/app/uploads/cache/25eb1bdac02de62c405a9c99ac70e813c2250241.php on line 2
( ! ) ErrorException: Class 'App' not found (View: /Users/redacted/valet/bedrock/web/app/themes/sage/resources/views/partials/page-header.blade.php) (View: /Users/redacted/valet/bedrock/web/app/themes/sage/resources/views/partials/page-header.blade.php) in /Users/redacted/valet/bedrock/web/app/uploads/cache/25eb1bdac02de62c405a9c99ac70e813c2250241.php on line 2
Note that I get the “Expected” result when cloning roots/sage into web/app/themes then running composer install from the web/app/themes/sage directory.
It seems like for some reason having soberwp/controller in the Bedrock vendor directory doesn’t work, which means that themes based on Sage won’t work if installed via Composer as per this thread: Yes or No - Sage can be part of bedrock using composer
Hi @ben, I’m building a theme based on Sage which I’d like to be installable using Composer — that’s why I didn’t follow the normal instructions. Is distributing a Sage-based theme for installation via Composer possible? It appears that it isn’t right now although the thread I linked to above suggests that it should be. Thanks for any clarification you can provide.
@patram1121 I’ve been tracking those changes and I can confirm I’m using the latest.
Sorry, I guess I wasn’t clear. I did create a Sage-based theme with the same dependencies as current dev-master. If I install it using Composer in a Bedrock environment (and Controller ends up in Bedrock’s vendor directory) then Controller doesn’t work. The only way I can get the Controller to work in a Bedrock environment is if Sage’s/my fork’s Composer dependencies are installed in web/app/themes/my-sage-fork/vendor.
The latter was created using composer create-project roots/sage:dev-master sage-controller. The only modification I made was changing the name in composer.json so that I could install the fork as a VCS repository.
I’ll note that the App, Home and About classes declared in app/controllers are not in the array of classes returned by get_declared_classes(). I can confirm that the files are being included by Bedrock’s autoloader but the classes themselves are not available. My assumption is that this has something to do with this method in roots/sage-lib and the context in which classes are loaded (at the Bedrock level vs. at the Sage level) but I don’t know enough about Illuminate/View to speculate any further.
Hey, y’all. I can also confirm this issue: a Sage-based theme in its own Git repo, with its own composer.json (the standard Sage one modified with the theme’s name) doesn’t autoload Controller properly.
I can confirm that, when composer install-ing the theme the first time, soberwp/controller is installed as a dependency of Bedrock, and that running composer install in the theme directory also installs Controller in the theme’s vendor directory, but neither instance seems to load, or work.
git clone-ing the theme works just fine, but I’d like to pull it in as a composer dependency if possible.
Other dependencies, like the stuff that makes Blade work, work fine, so perhaps this is a Controller-specific problem? @withjacoby can you lend some insight?
I know this is quite a bit later, but I hit this issue recently. My Digital Ocean dev server is running PHP < 7.1 so I had to install a legacy version of Sage. I pulled the composer.json from the 9.0.0 release, ran composer install and everything seemed to go OK. Then I saw the Class 'App' not found error.
I found that it was just a capitalisation issue. The theme’s path to App was app/Controllers/App.php - note the capital “C”. I changed it to lowercase so the path became app/controllers/App.php and hey presto! It worked.