Laravel image validation example

PHP
'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',$this->validate($request, ['file' => 'image|mimes:jpeg,png,jpg,gif,svg|max:2048',]);

Source

Also in PHP: