# Sage 9 with PHP 8.1

**URL:** https://discourse.roots.io/t/sage-9-with-php-8-1/25013
**Category:** sage
**Created:** 2023-03-23T10:16:43Z
**Posts:** 2

## Post 1 by @shehryar — 2023-03-23T10:16:43Z

Hi,

I was trying to update the dependencies and was following this.

> [@Sage 9 + PHP 8.0](https://discourse.roots.io/t/sage-9-php-8-0/22485):
>
> I was inquiring earlier about upgrading Sage 9 to work with PHP 8.0 and just found a public github fork of sage which does just that. I saw other inquiries about the same thing, so I thought I would write a message here for those who are looking for this: Here is the changes in composer.json (not the full file, just the bit with changes): "autoload": { "psr-4": { "App\\": "app/" } }, "repositories": [ { "type": "vcs", "url": "https://github.com/jeh5256/sage-installe…

I am working on the localhost Xamp on windows and used this composer.json file.

```
{
  "name": "roots/sage",
  "type": "wordpress-theme",
  "license": "MIT",
  "description": "WordPress starter theme with a modern development workflow",
  "homepage": "https://roots.io/sage/",
  "authors": [
    {
      "name": "Ben Word",
      "email": "ben@benword.com",
      "homepage": "https://github.com/retlehs"
    },
    {
      "name": "Scott Walkinshaw",
      "email": "scott.walkinshaw@gmail.com",
      "homepage": "https://github.com/swalkinshaw"
    },
    {
      "name": "QWp6t",
      "email": "hi@qwp6t.me",
      "homepage": "https://github.com/qwp6t"
    }
  ],
  "keywords": ["wordpress"],
  "support": {
    "issues": "https://github.com/roots/sage/issues",
    "forum": "https://discourse.roots.io/"
  },
  "autoload": {
    "psr-4": {
      "App\\": "app/"
    }
  },
  "repositories": [
    { "type": "vcs", "url": "https://github.com/jeh5256/sage-installer"},
    { "type":"vcs", "url":"https://github.com/jeh5256/sage-lib" }
  ],
  "require": {
    "php": ">=7.1",
    "composer/installers": "~2.0",
    "illuminate/support": "^8.0",
    "roots/sage-lib": "dev-master",
    "soberwp/controller": "~2.1.0"
  },
  "require-dev": {
    "squizlabs/php_codesniffer": "^2.8.0",
    "roots/sage-installer": "dev-master"
  },
  "scripts": {
    "test": ["phpcs"],
    "post-create-project-cmd": [
      "Roots\\Sage\\Installer\\ComposerScript::postCreateProject"
    ]
  }
}
```

After running Update Composer, I am getting this error.

```
Fatal error: Uncaught ReflectionException: Class "App\Controllers\App" does not exist in C:\xampp\htdocs\php\wp-content\themes\zaks-sage\vendor\soberwp\controller\src\Loader.php:75 Stack trace: #0 C:\xampp\htdocs\php\wp-content\themes\zaks-sage\vendor\soberwp\controller\src\Loader.php(75): ReflectionClass->__construct('App\\Controllers...') #1 C:\xampp\htdocs\php\wp-content\themes\zaks-sage\vendor\soberwp\controller\src\Loader.php(35): Sober\Controller\Loader->setPath() #2 C:\xampp\htdocs\php\wp-content\themes\zaks-sage\vendor\soberwp\controller\controller.php(41): Sober\Controller\Loader->__construct(Object(Brain\Hierarchy\Hierarchy)) #3 C:\xampp\htdocs\php\wp-includes\class-wp-hook.php(308): Sober\Controller\loader('') #4 C:\xampp\htdocs\php\wp-includes\class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array) #5 C:\xampp\htdocs\php\wp-includes\plugin.php(517): WP_Hook->do_action(Array) #6 C:\xampp\htdocs\php\wp-settings.php(617): do_action('init') #7 C:\xampp\htdocs\php\wp-config.php(97): require_once('C:\\xampp\\htdocs...') #8 C:\xampp\htdocs\php\wp-load.php(50): require_once('C:\\xampp\\htdocs...') #9 C:\xampp\htdocs\php\wp-admin\admin.php(34): require_once('C:\\xampp\\htdocs...') #10 C:\xampp\htdocs\php\wp-admin\themes.php(10): require_once('C:\\xampp\\htdocs...') #11 {main} thrown in C:\xampp\htdocs\php\wp-content\themes\zaks-sage\vendor\soberwp\controller\src\Loader.php on line 75
```

Can anyone please help me?

 ![issue194](https://discourse.roots.io/uploads/default/original/2X/5/556f9840598aa78dbe12cda91e5ebfa29fa4d3fb.jpeg)

---

## Post 2 by @strarsis — 2023-06-23T16:50:23Z

> [@shehryar](#):
>
> `ReflectionException: Class "App\Controllers\App" does`

The reason is the case sensitivity of the directories names, see this issue and the fix:

> <https://github.com/soberwp/controller/issues/75#issuecomment-380134629>
>
> Hi,
> 
> I posted an issue I was having with a site I'm developing which I ran int…o when deploying it to my staging server [here](https://discourse.roots.io/t/fatal-uncaught-reflectionexception-error-with-controller-2-0-0/11859). I've had to bite the bullet and revert back to the 9.0.0-beta.4 version of controller to get around this. But I thought I'd post here because I have now tried setting up a completely fresh install of bedrock/sage with no development work, all I've done is change controller to version 2, run `composer update` and install ACF Pro. I renamed app.php to App.php and changed it's namespace to App\Controllers. However I still get this error on my staging server:
> ```
> [09-Mar-2018 12:33:48 UTC] PHP Fatal error: Uncaught ReflectionException: Class App\Controllers\App does not exist in /home/chapterserver1/dev/test/web/app/themes/bbc/vendor/soberwp/controller/src/Loader.php:119
> Stack trace:
> #0 /home/chapterserver1/dev/test/web/app/themes/bbc/vendor/soberwp/controller/src/Loader.php(119): ReflectionClass->__construct('App\\Controllers...')
> #1 /home/chapterserver1/dev/test/web/app/themes/bbc/vendor/soberwp/controller/src/Loader.php(49): Sober\Controller\Loader->setClassesAlias()
> #2 /home/chapterserver1/dev/test/web/app/themes/bbc/vendor/soberwp/controller/controller.php(22): Sober\Controller\Loader->__construct(Object(Brain\Hierarchy\Hierarchy))
> #3 /home/chapterserver1/dev/test/web/wp/wp-includes/class-wp-hook.php(286): Sober\Controller\loader('')
> #4 /home/chapterserver1/dev/test/web/wp/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
> #5 /home/chapterserver1/dev/test/web/wp/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
> #6 /home/chapterserver1/dev/test/web/wp/wp-settings.php(450): do_actio in /home/chapterserver1/dev/test/web/app/themes/bbc/vendor/soberwp/controller/src/Loader.php on line 119
> ```
> It runs fine when I change Controller back to the old version and `composer update`
> 
> This exactly mirrors the error I was getting previously, however I don't get this on my local dev site.
> 
> You can see my phpinfo [here](http://www.chapterserver1.co.uk/phpinfo.php)
> 
> I have also tried the solution posted in [this commit](https://github.com/hambos22/sage-woo/commit/84aad57c3c2c6be7e8aaae8fbf2e9b4f32fa03cb) but with no luck.
> Hope someone can help with this as I would like to be able to access my ACF fields in a slicker way.
> 
> Many thanks
> Kevin
