Laravel parse error: syntax error, unexpected T_CLASS, expecting T_STRING or T_VARIABLE

Laravel 5.1 uses the ::class property to get string representations of a fully qualified classname. The error you’re seeing is caused by this line

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

This language feature has been introduced in PHP 5.5 which is a requirement of Laravel 5.1. Your installed PHP version is probably older than 5.5. Try to update your PHP binary.


In case you are interested in why ::class is used, take a look at this answer

Leave a Comment