Added compatibilty with older versions of PHP and Laravel