Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mniblett's avatar

Don't understand error: Class 'App\Http\Controllers\... not found

OK, i know based on the error message this is probably pretty basic: I am attempting to use JoeDawson/amazon-ecs in my project, the error I am getting is: Class 'App\Http\Controllers\Amazon' not found I am not even sure why it would be looking for a controller named Amazon there...I have a facade called Amazon but it refers to a class in vendor directory.

My route: Route::get('/books/add', 'BooksController@add'); BooksController:

    {
        $product = Amazon::lookup('B004VLKY8M')->json();
        return $product;

    }

I have the facade and service providers in app.php

'Amazon' => Dawson\AmazonECS\AmazonECSFacade::class, 
Dawson\AmazonECS\AmazonECSServiceProvider::class,

Can't figure out why it is looking for a controller? Guessing this is something really basic...

0 likes
9 replies
zachleigh's avatar

You need to import the facade at the top of the file:

use Amazon;

You didn't tell it where to look so it is looking in the current directory, Controllers.

mniblett's avatar

Tried Use Amazon; Use App\Amazon; Use Dawson\AmazonECS\Amazon;

I get class not found on all of them.

I have the facade in the alias section and the service provider in the providers section of app.config. It should be using the facade to find the class right?

I don't really understand how it finds the right files. For instance, all the built in facades are under vendor\laravel\framework\src\illuminate and the facade path starts right in with illuminate in app\config. Is there some step you have to do to tell it what src folder to look under for those facades.

The facade I am using says 'Amazon' => Dawson\AmazonECS\AmazonECSFacade::class, but the file is really inside a src folder under the amazonECS folder.

zachleigh's avatar

The path doesnt matter. What is the namespace of the file?

Try this:

use Dawson\AmazonECS\AmazonECS;
mniblett's avatar

namespace Dawson\AmazonECS;

Tried: use Dawson\AmazonECS\AmazonECS;, use Dawson\AmazonECS\Amazon; etc.

Error keeps saying it's looking under controllers folder for the class: App\Http\Controllers\Amazon

But it is in app\config as: 'Amazon' => Dawson\AmazonECS\AmazonECSFacade::class,

the facade is:

class AmazonECSFacade extends Facade
{
    protected static function getFacadeAccessor()
    {
        return 'amazon-ecs';
    }
}

Edit: when I did the original install the docs said to run:

php artisan vendor:publish --provider="Dawson\AmazonECS\AmazonECSServiceProvider" and I got this result: Nothing to publish for tag []. But I did copy the AmazonECSServiceProvider into app\providers directory (as well as copied the config file)

zachleigh's avatar

You dont need to copy the service provider. How about this:

use Dawson\AmazonECS\AmazonECS as Amazon;

Show me your app.php file. I have a feeling its not registered correctly.

mniblett's avatar

use Dawson\AmazonECS\AmazonECS as Amazon; yields error: Non-static method Dawson\AmazonECS\AmazonECS::lookup() should not be called statically

here is the providers section of app.php:

'providers' => [

        /*
         * Laravel Framework Service Providers...
         */
        Illuminate\Auth\AuthServiceProvider::class,
        Illuminate\Broadcasting\BroadcastServiceProvider::class,
        Illuminate\Bus\BusServiceProvider::class,
        Illuminate\Cache\CacheServiceProvider::class,
        Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
        Illuminate\Cookie\CookieServiceProvider::class,
        Illuminate\Database\DatabaseServiceProvider::class,
        Illuminate\Encryption\EncryptionServiceProvider::class,
        Illuminate\Filesystem\FilesystemServiceProvider::class,
        Illuminate\Foundation\Providers\FoundationServiceProvider::class,
        Illuminate\Hashing\HashServiceProvider::class,
        Illuminate\Mail\MailServiceProvider::class,
        Illuminate\Notifications\NotificationServiceProvider::class,
        Illuminate\Pagination\PaginationServiceProvider::class,
        Illuminate\Pipeline\PipelineServiceProvider::class,
        Illuminate\Queue\QueueServiceProvider::class,
        Illuminate\Redis\RedisServiceProvider::class,
        Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
        Illuminate\Session\SessionServiceProvider::class,
        Illuminate\Translation\TranslationServiceProvider::class,
        Illuminate\Validation\ValidationServiceProvider::class,
        Illuminate\View\ViewServiceProvider::class,
        Dawson\AmazonECS\AmazonECSServiceProvider::class,

        /*
         * Package Service Providers...
         */

and the aliases section:

'aliases' => [

        'App' => Illuminate\Support\Facades\App::class,
        'Artisan' => Illuminate\Support\Facades\Artisan::class,
        'Auth' => Illuminate\Support\Facades\Auth::class,
        'Blade' => Illuminate\Support\Facades\Blade::class,
        'Cache' => Illuminate\Support\Facades\Cache::class,
        'Config' => Illuminate\Support\Facades\Config::class,
        'Cookie' => Illuminate\Support\Facades\Cookie::class,
        'Crypt' => Illuminate\Support\Facades\Crypt::class,
        'DB' => Illuminate\Support\Facades\DB::class,
        'Eloquent' => Illuminate\Database\Eloquent\Model::class,
        'Event' => Illuminate\Support\Facades\Event::class,
        'File' => Illuminate\Support\Facades\File::class,
        'Gate' => Illuminate\Support\Facades\Gate::class,
        'Hash' => Illuminate\Support\Facades\Hash::class,
        'Lang' => Illuminate\Support\Facades\Lang::class,
        'Log' => Illuminate\Support\Facades\Log::class,
        'Mail' => Illuminate\Support\Facades\Mail::class,
        'Notification' => Illuminate\Support\Facades\Notification::class,
        'Password' => Illuminate\Support\Facades\Password::class,
        'Queue' => Illuminate\Support\Facades\Queue::class,
        'Redirect' => Illuminate\Support\Facades\Redirect::class,
        'Redis' => Illuminate\Support\Facades\Redis::class,
        'Request' => Illuminate\Support\Facades\Request::class,
        'Response' => Illuminate\Support\Facades\Response::class,
        'Route' => Illuminate\Support\Facades\Route::class,
        'Schema' => Illuminate\Support\Facades\Schema::class,
        'Session' => Illuminate\Support\Facades\Session::class,
        'Storage' => Illuminate\Support\Facades\Storage::class,
        'URL' => Illuminate\Support\Facades\URL::class,
        'Validator' => Illuminate\Support\Facades\Validator::class,
        'View' => Illuminate\Support\Facades\View::class,
        'Amazon' => Dawson\AmazonECS\AmazonECSFacade::class,

    ],

I really appreciate you taking the time to try and help me.

mniblett's avatar
mniblett
OP
Best Answer
Level 5

solution was to put a slash in front of the facade alias:

$product = \Amazon::lookup('B00YQBTMNK')->json();

1 like
eightroom's avatar

Solution is add an slash to already loaded service... not sounds like a solution but only you response works after 4 years, im facing same issue with a facade based on already existent service and binded.

Please or to participate in this conversation.