According to the documentation of the latest release Laravel 5.0 (as of the time when this article is written), at http://laravel.com/docs/5.0#server-requirements.
It requires :
- PHP >= 5.4
However, if you follow any tutorial or guide on Laravel 5 Events, you will see the event binding defined,
protected $listen = [
‘event.name’ => [
UserWasRegistered::class => [
Be aware of the syntax ::class , which is the class name resolution syntax that is mentioned as new feature of PHP 5.5, http://php.net/manual/en/migration55.new-features.php
If you are, by accident, running a server with PHP < 5.5, the artisan command will bump with the following error.
syntax error, unexpected ‘class’ (T_CLASS), expecting identifier (T_STRING)
The solution is simple, instead of using ::class syntax, just define events as strings. That’s all you need to do. Do it your way.
‘user.registered’ => [
Probably, there are several ways to do it. I bet you can find more of it.
Anyway, have fun ! ☺