I have the following code, where I get the error "PHP Fatal Error: Constant expression contains invalid operations". It works fine when I define the variable in the constructor. I am using Laravel framework.
<?php namespace App; class Amazon { protected $serviceURL = config('api.amazon.service_url'); public function __construct() { } } I have seen this question: PHP Error : Fatal error: Constant expression contains invalid operations But my code does not declare anything as static, so that did not answer my question.