# Slim Application Error - Class ‘Slim\\Http\\MobileRequest’ not found

**URL:** <https://discourse.slimframework.com/t/slim-application-error-class-slim-http-mobilerequest-not-found/5149>\
**Category:** Questions\
**Created:** [February 16, 2022, 2:42pm UTC](https://discourse.slimframework.com/t/slim-application-error-class-slim-http-mobilerequest-not-found/5149 "2022-02-16T14:42:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bop](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bop](https://discourse.slimframework.com/u/bop)\
**Post date:** [February 16, 2022, 2:42pm UTC](https://discourse.slimframework.com/t/slim-application-error-class-slim-http-mobilerequest-not-found/5149/1 "2022-02-16T14:42:55Z")

</div>

Hi,

I’m sorry if this might look like an unnecessary question, but I’m totally new to PHP based stuff and quite new to web development in general. I got a task to make a website work again, which returns the following error message, when trying to visit it. I couldn’t figure out what the problem is. The project was done with Slim 3. Would an upgrade to Slim 4 maybe help?  
Thanks.

Slim Application Error  
The application could not run because of the following error:

Details  
Type: Error

Message: Class ‘Slim\Http\MobileRequest’ not found

File: /is/htdocs/…/src/middleware.php

Line: 32

Trace

#0 [internal function]: Closure-\>{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Closure))  
#1 /is/htdocs/…/vendor/slim/slim/Slim/DeferredCallable.php(57): call\_user\_func\_array(Object(Closure), Array)  
#2 [internal function]: Slim\DeferredCallable-\>\_\_invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Closure))  
#3 /is/htdocs/…/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call\_user\_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Closure))  
#4 /is/htdocs/…/src/middleware.php(40): Slim\App-\>Slim{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response))  
#5 [internal function]: Closure-\>{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Closure))  
#6 /is/htdocs/…/vendor/slim/slim/Slim/DeferredCallable.php(57): call\_user\_func\_array(Object(Closure), Array)  
#7 [internal function]: Slim\DeferredCallable-\>\_\_invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Closure))  
#8 /is/htdocs/…/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call\_user\_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Closure))  
#9 /is/htdocs/…/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\App-\>Slim{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response))  
#10 /is/htdocs/…/vendor/slim/slim/Slim/App.php(392): Slim\App-\>callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))  
#11 /is/htdocs/…/vendor/slim/slim/Slim/App.php(297): Slim\App-\>process(Object(Slim\Http\Request), Object(Slim\Http\Response))  
#12 /is/htdocs/…/index.php(55): Slim\App-\>run()  
#13 {main}

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [February 16, 2022, 7:28pm UTC](https://discourse.slimframework.com/t/slim-application-error-class-slim-http-mobilerequest-not-found/5149/2 "2022-02-16T19:28:10Z")

</div>

Hi Bob!

The class `Slim\Http\MobileRequest` does not belong to any Slim Framework version, but I found this class in the [zguillez/slim-mobile-detect](https://github.com/zguillez/slim-mobile-detect) package.

To fix this, you could just run `composer install` to install all missing packages and to update the autoloader.

If this does not work, try to install the package with this command: `composer require zguillez/slim-mobile-detect`

---

<div class="post-metadata">

**Author:** ![bop](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bop](https://discourse.slimframework.com/u/bop)\
**Post date:** [February 17, 2022, 9:01am UTC](https://discourse.slimframework.com/t/slim-application-error-class-slim-http-mobilerequest-not-found/5149/3 "2022-02-17T09:01:06Z")

</div>

Hi Odan,

Thank you for your help! A few days ago I tried composer update, but revoked it.  
Now I had to perform composer update first before composer install. Composer install alone couldn’t be implemented. After composer update and composer install the same error message appeared so I tried composer require zguillez/slim-mobile-detect. unfortunately the error message still occurs.

---

<div class="post-metadata">

**Author:** ![Aman](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@Aman](https://discourse.slimframework.com/u/Aman)\
**Post date:** [May 21, 2024, 11:10am UTC](https://discourse.slimframework.com/t/slim-application-error-class-slim-http-mobilerequest-not-found/5149/4 "2024-05-21T11:10:48Z")

</div>

Hi  
I also have same error

# Slim Application Error

The application could not run because of the following error:

## Details

**Type:** Error

**Message:** Class “App\Middleware\CustomMiddleware” not found

**File:** C:\wamp64\www\slim\project\public\index.php

**Line:** 43

## Trace

#0 C:\wamp64\www\slim\vendor\pimple\pimple\src\Pimple\Container.php(122): {closure}(Object(Slim\Container)) #1 C:\wamp64\www\slim\vendor\slim\slim\Slim\Container.php(109): Pimple\Container-\>offsetGet(‘CustomMiddlewar…’) #2 C:\wamp64\www\slim\vendor\slim\slim\Slim\CallableResolver.php(95): Slim\Container-\>get(‘CustomMiddlewar…’) #3 C:\wamp64\www\slim\vendor\slim\slim\Slim\CallableResolver.php(58): Slim\CallableResolver-\>resolveCallable(‘CustomMiddlewar…’, ‘\_\_invoke’) #4 C:\wamp64\www\slim\vendor\slim\slim\Slim\CallableResolverAwareTrait.php(41): Slim\CallableResolver-\>resolve(‘CustomMiddlewar…’) #5 C:\wamp64\www\slim\vendor\slim\slim\Slim\DeferredCallable.php(50): Slim\DeferredCallable-\>resolveCallable(‘CustomMiddlewar…’) #6 [internal function]: Slim\DeferredCallable-\>\_\_invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\App)) #7 C:\wamp64\www\slim\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(70): call\_user\_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\App)) #8 C:\wamp64\www\slim\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(117): Slim\App-\>Slim{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response)) #9 C:\wamp64\www\slim\vendor\slim\slim\Slim\App.php(392): Slim\App-\>callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response)) #10 C:\wamp64\www\slim\vendor\slim\slim\Slim\App.php(297): Slim\App-\>process(Object(Slim\Http\Request), Object(Slim\Http\Response)) #11 C:\wamp64\www\slim\project\public\index.php(53): Slim\App-\>run() #12 {main}  
and I also check all the file and update composer.json 2 time but same error
