Interface Not Found

Fatal error: Uncaught Error: Interface 'App\Contract\Loggable' not found

Quick Answer

PHP cannot find the specified interface. Verify the namespace, file path, and autoloader configuration. Ensure the interface file exists and is properly autoloaded.

Why This Happens

This error is similar to class not found but specifically for interfaces. It occurs when a class tries to implement an interface that PHP cannot locate. The causes are the same: wrong namespace, missing use statement, or autoloader misconfiguration.

The Problem

namespace App\Service;

class UserService implements Loggable { // Missing use statement
    // ...
}

The Fix

namespace App\Service;

use App\Contract\Loggable;

class UserService implements Loggable {
    // ...
}

Step-by-Step Fix

  1. 1

    Check the interface name

    Verify the fully qualified interface name matches the namespace and interface declaration in the source file.

  2. 2

    Add the use statement

    Add a use statement at the top of the file to import the interface from its correct namespace.

  3. 3

    Verify autoloading

    Ensure the interface file exists at the path Composer expects based on PSR-4 mapping, and run composer dump-autoload.

Bugsly catches this automatically

Bugsly's AI analyzes this error pattern in real-time, explains what went wrong in plain English, and suggests the exact fix — before your users even report it.

Try Bugsly free