Sage - SoberWp Controller - {! App::title() !} in blade view is not working

+1 Im getting exactly the same bug.

Is this a fresh Sage install? How did you create it? Did you use composer to create it, or did you clone from GitHub?

Are you using Trellis and/or Bedrock?

If you remove the App:title() call does it work? Or do you get a different error?

Hi @MWDelaney

Yep fresh install. Composer was used.

This happens for any static method called on the App controller

What’s your environment like? Are you using Trellis? More specifically, what version of PHP are you using?

Not using Trellis. We use Laravel’s Homestead enviroment and php deployer to deploy which works with all our other sites. PHP 7.1 is being used.

Hmm. I’m short on ideas. Is it possible to test the theme in a different environment to rule out the environment as the problem? Either a shared host somewhere, or a quick and dirty Trellis setup?

It does seem like an enviroment issue… although other Sage sites are running and using static methods just fine in this exact enviroment.

It’s an environment difference, probably case-sensitivity — what works on a case-insensitive Mac local might not work on a case sensitive linux server. Check the error logs and look at file names in app/controller.

Issues with case were fixed in Sober Controller 2.0.1

1 Like

I can confirm that this is still a valid bug. I downloaded the Sage theme and installed it out of the box. I am getting this error:

Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Class 'App' not found in /web/htdocs3/xxxxxxxx/home/www/wp-content/uploads/sites/3/cache/ae3e6bb8ed1b2e659d526c1845c364f3d3d44fcd.php:2 Stack trace: #0 /web/htdocs3/xxxxxxxx/home/www/wp-content/themes/d3sage/vendor/illuminate/view/Engines/PhpEngine.php(43): include() #1 /web/htdocs3/xxxxxxxx/home/www/wp-content/themes/d3sage/vendor/illuminate/view/Engines/CompilerEngine.php(59): Illuminate\View\Engines\PhpEngine->evaluatePath('/web/htdocs3/di...', Array) #2 /web/htdocs3/xxxxxxxx/home/www/wp-content/themes/d3sage/vendor/illuminate/view/View.php(142): Illuminate\View\Engines\CompilerEngine->get('/web/htdocs3/di...', Array) #3 /web/htdocs3/xxxxxxxx/home/www/wp-content/themes/d3sage/vendor/illuminate/view/View.php(125): Illuminate\View\View->getContents() #4 /web/htdocs3/xxxxxxxx/home/www/wp-content/themes/d3sage/vendor/illuminate/view/View.php(90): Illuminate\View\View->renderContents() #5 /web/htdocs3/xxxxxxxx/home/www/w in /web/htdocs3/xxxxxxxx/home/www/wp-content/uploads/sites/3/cache/ae3e6bb8ed1b2e659d526c1845c364f3d3d44fcd.php on line 2

I tried to gather as much information as possible. Could you please help me with this? The only solution I can come up with is to remove {!! App::title() !!} from this file: resources\views\partials\page-header.blade.php (line 2). Then it works. But it would be better if the theme worked out of the box even on my server configuration which I have no control over - it’s set up by the hosting provider.

This is the server settings as provided by my hosting provider:


  • Linux CentOS
  • Apache 2.2
  • Server Side Includes - SSI


  • version 7.1.3
  • system: Linux webxc03s07 2.6.32-696.18.7.el6.x86_64 #1 SMP Thu Jan 4 17:31:22 UTC 2018 x86_64
  • configuration: normal_default_71
  • execution_time: 90 sec
  • memory_limit: 128MB
  • upload_limit: 32MB
  • ini_set
  • safe_mode OFF
  • register_globals OFF
  • extensions: gd2, ImageMagick, Zip

Server supports the following: HTML, PHP, Perl, Ruby, Python, SHTML and Flash/Shockwave.

1 Like
  • What version of Sage are you using? How did you install it?
  • Did you run composer install in your theme directory, and include the generated vendor folder when uploading to your sever?
  • Do other variables provided by Controller work as intended in your templates?
  • Sage version 9.0.1
  • Yes, I ran composer install locally, then I uploaded the vendor folder to hosting provider via FTP
  • I didn’t notice any other changes / problems. I had to modify paths in these files manually upon deployment:
  1. config\assets.php
  2. config\theme.php
  3. config\view.php
  4. resources\functions.php and also I had to move this file out of the resources folder and put it directly to the theme folder on the server to make the theme work, and modify the paths in the file to autoload.php

What were the paths you had to modify? How does the organization of your production theme vary from your development theme?

Here are the paths I had to modify. Notice that my theme is called d3sage.

Plus like I said I moved the functions.php file from resources to the root of my theme folder on the production server to make the theme work.

You may have broken composer autoloading (which is how Sage finds stuff in the App namespace) by changing the makeup of your theme. I would recommend modifying your local development environment to match your remote environment exactly, running composer install again, and re-uploading the theme. I’m curious why you needed move things around, though. I’ve never had trouble with that when adding a theme via FTP.

What do you mean by that? I just installed the theme locally with no further changes and wanted to deploy it to my production server to test it if it works out of the box.

I was also confused by the documentation which doesn’t mention a word about what should be copied to the server via FTP. At first I thought it was only the contents of the dist folder but then realized it only contained the assets. Maybe an update of the documentation (how to deploy via FTP) would make this whole process easier.

I tried running composer install locally (since I can’t run it on the production server). The paths were OK for local development but wrong for the production so that’s why I had to modify them manually. The question is why?

Also we got distracted from the original issue – why using the {!! App::title() !!} in resources\views\partials\page-header.blade.php breaks the theme and shows the error I posted originally. Any ideas how to solve that issue?

As with any WordPress theme, everything should work if you copy the entire directory. If you want, you can skip node_modules, .git, and app/assets.

“Why” depends on the configuration of your local and production environments. Because you haven’t provided whatever the errors were that prompted you to change them, I can’t guess what the cause might be.

Paths are very pertinent to this issue. Look at the error you posted:

Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Class 'App' not found in [...]

This means that PHP is unable to find the class App. It knows (or should know) where to find App because of this section of your theme’s composer.json:

"autoload": {
    "psr-4": {
      "App\\": "app/"

Essentially, that says “If anything asks for the App class, you can find it in app/.” When you run composer install (or update or dump-autoload) Composer will generate an autoloader based on that, which will then be used to load classes when they are requested. If you want to see what it generates, you can look in vendor/composer/autoload_psr4.php. If you run composer install and then move files around in your theme, these paths may no longer be correct. I don’t fully understand the changes you’ve made to your theme (it looks like you’ve put some of it in a subfolder of itself, with the same name as the theme itself?), so I’m not sure if that’s the problem.

In general, though, it’s a very good practice to make sure that your local development environment matches your production environment as exactly as possible, include the file organization of your theme.

Thanks so much for being so patient and your explanation. I decided to start over and found out that it was all my fault and that the problem is the deployment process. When I look at the Sage documentation for deployment it is not clear to me what needs to be copied via FTP to the server and what is not needed for the production site. Here’s my summary:

Do NOT copy via FTP to production server:

  • .cache-loader folder
  • node_modules folder
  • resources/assets folder
  • all files in the root folder (.editorconfig, .eslintrc.js, .gitignore,,, composer.json, composer.lock,, package.json, package-lock.json, phpcs.xml,, yarn.lock)

DO copy via FTP to production server:

  • app folder
  • config folder
  • dist folder
  • resources folder but not the resources/assets subfolder
  • vendor folder

This is what needs to be put in the deployment documentation or I suggest automating this process somehow via a new yarn command (for example yarn build:preparedeploy) which would create a new folder (for example deploy) and put all files that need to be copied via FTP to the production server in that folder. This is intended for people like me who deploy their website manually via FTP, use a shared hosting server, and can’t run composer install on the production server. What do you think?

This also fixes the problems with paths and using App::title() as there are no path issues if deployed properly.

I am not the first one who had a hard time - see How do you actually deploy the Sage theme to a Wordpress site?! - my summary should also be added to that topic thread but it’s already closed so I’ll leave that up to you. Ideally it should be in the documentation.

Glad you were able to figure it out! If you have a contribution to the documentation, pull requests are always welcome:

1 Like

Thank you for your help. Appreciate it. This can be closed now. Pull request for docs change is at

1 Like

I’d like to chime in with my own solution. I run Trellis + Bedrock + Sage.

Inside my Bedrock composer.json file (/ I had roots/sage as a dependency. I have no idea how this happened…

When my Sage theme went to check if the class Roots\Sage\Controller exists in functions.php before including it’s own composer auto loader it was already defined. I simply removed the dependency at the top level and everything worked.