Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

retailsonar's avatar

Change end of line character when generating code with php artisan make commands

Is there a way to change the end of line character used by the php artisan commands?

My current machine is a Windows laptop, and when I run commands like php artisan make:test SomeTest, I would the generated file to use Unix end of line characters (lf), \n instead of the Windows (crlf) \r\n.

0 likes
2 replies
somnathsah's avatar

you can use php constant PHP_EOL , which is platform independent.

retailsonar's avatar

Ok, nevermind, I found the issue. It was git related.

My .gitattributes were set to auto. So files created on my machine used the CRLF character. When I add/changed this * text eol=lf to the .gitattributes file and refreshed my local git repo, all the files used the correct eol character.

Please or to participate in this conversation.