PHP Laravel – Controller does not exist

Solution:

The reason for this is just like the exception says: it could not find the PostController in your declared namespace.

The reason for that highly depends on the Laravel version you are using. Laravel 8 removed the default namespacing to App\Http\Controllers, so if you are using Laravel 8 but have followed a tutorial for an earlier Laravel version, that might be the reason.

However, using the declaration using class imports is the better way to do it anyways, so I would stick with that.