Laravel says Class Input not found in old code
Class 'Input' not foundShort answer
Laravel removed the Input facade in version 6.0 because it duplicated the Request facade. Code written for Laravel 5 that calls Input::get() fails on any current version. Replace it with Request::input() or the request object, and import the Request class when your file has a namespace.
Fix it fast
1Find out which cause you have
Find every use of the old facade in the application.
grep -rn "Input::" app routes resources2Match what you see, then jump to its fix
What does the error look like?
Class 'Input' not found
Cause 1 of 2
The Input facade no longer exists
1Check
The Laravel 6 upgrade guide lists the Input facade as removed. It was mostly a duplicate of Request.
grep -rn "Input::" app routes resources2Fix
Change Input::get to Request::input. Other Input calls can use the Request facade. In controllers, prefer the injected request object.
use Illuminate\Http\Request;
public function store(Request $request)
{
$name = $request->input('name');
}3Verify
Reload the page that failed.
curl -I http://localhost/your-routeConfirmed by laravel.com
Cause 2 of 2
A facade is used in a namespaced file without being imported
1Check
Inside a namespace, PHP looks for an unqualified class name in that same namespace and does not fall back to the global one. Laravel's facades live in Illuminate\Support\Facades.
grep -n "^use " app/Http/Controllers/MyController.php2Fix
Import the facade with use, or prefix it with a backslash.
use Illuminate\Support\Facades\Request;
$name = Request::input('name');3Verify
Run the route again.
curl -I http://localhost/your-routeConfirmed by php.net
How do I stop it coming back?
- Read the upgrade guide of each major version when a project jumps several versions.
- Import every facade with use instead of relying on global aliases.
- Prefer the injected Illuminate\Http\Request in controllers over any facade.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
Composer says the gd extension is missing on a Laravel project
composer install or composer update stops on a package that requires ext-gd
Composer refuses to install a package that requires ext-gd when the PHP binary running Composer has no GD extension.
4 causes, each with a fixBack end
composer require maatwebsite/excel fails to install
Composer says the package needs an older PHP than the one installed
Composer refuses maatwebsite/excel when the PHP version or a PHP extension does not match what the package and PhpSpreadsheet need.
3 causes, each with a fixBack end
composer install says the lock file is not compatible and asks for update
Your lock file does not contain a compatible set of packages. Please run composer update.
composer install checked the locked packages against this machine's PHP and extensions and found a conflict.
3 causes, each with a fixBack end
composer require laravel/horizon fails: ext-pcntl is missing
laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system
Horizon needs the pcntl extension, and Composer refuses to install it where PHP lacks that extension.
3 causes, each with a fixBack end
composer require laravel/passport stops with 'requirements could not be resolved'
... but these were not loaded, likely because it conflicts with another require.
Composer found no Passport release that fits your project at once.
4 causes, each with a fixBack end
Composer says the root composer.json requires a PHP version your PHP does not satisfy
Your requirements could not be resolved to an installable set of packages.
Composer compares the php constraint in your composer.json, or in a package, with the PHP that runs Composer.
3 causes, each with a fix