You are receiving this error because "class" is a reserved keyword in PHP.
You can find a list of all reserved keywords at the following URL: http://php.net/manual/en/reserved.keywords.php
Perhaps you can use Classroom, Lesson, or Type instead?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a model called Class and User.
my User model has this line of code.
use App\Class; its giving me an error "syntax error, unexpected 'Class' (T_CLASS), expecting identifier (T_STRING)"
but when I use other names its just fine. could someone tell me why its not possible to use the word Class as a classname
You are receiving this error because "class" is a reserved keyword in PHP.
You can find a list of all reserved keywords at the following URL: http://php.net/manual/en/reserved.keywords.php
Perhaps you can use Classroom, Lesson, or Type instead?
Please or to participate in this conversation.