laravel error : Namespace declaration statement has to be the very first statement or after any declare call in the script laravel error : Namespace declaration statement has to be the very first statement or after any declare call in the script laravel laravel

laravel error : Namespace declaration statement has to be the very first statement or after any declare call in the script


There is an empty space before the <?php tag. Remove it.

<?phpnamespace App\Models;


If problem continue you have to remove bom from file via notepad++


Also check that your IDE create UTF-8 files (with NO BOM) UTF-8 BOM.For example, in phpStorm Settings / Editor / File Encodings -> Create UTF-8 files: with NO BOM