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

NoelDeMartin's avatar

Fixing php coding standard locally & StyleCI

I have been looking into how does Laravel apply php style conventions, and they use styleci.io which I have used and is great.

I am now trying to setup CI for a new project and I want to have the style checked as part of the build, but I am finding an issue with StyleCI because it only works online. As far as I know from Laracasts lessons, Jeffrey recommends using phpcs, but I haven't found a way to keep that compatible with styleci (other than trying to have the same standard, but it's difficult because they don't use the same nomenclature).

So what is the actual "best practice" at the moment, if any? Seems like the laravel/framework repository relies only on StyleCI and any problem is automatically fixed, but I don't like tools modifying my code automatically so I prefer to get an error if something is wrong. It'd be great to see those errors beforehand in my code editor instead of having to push to validate my code.

Is the only option to achieve this to use StyleCI online and phpcs locally, with all the headaches of making sure that the standards are compatible?

Edit: It'd also be possible to use phpcs as part of the build in Travis, like phpunit is used, but I like the fact that StyleCI is only styles so I think it's good to keep those separated.

0 likes
4 replies
bobbybouwmann's avatar
Level 88

You can run phpcs for styles only as well! We are running GitLab pipelines with PHPCS and Laravel a lot. Before we had this running in Github with Travis as well.

I don't see a reason to use both StyleCI and PHPCS. If PHPCS has failed you fix the stuff until it's fixed. After that you don't need StyleCI anymore right?

What specific question do you have? :D

NoelDeMartin's avatar

Well I guess that answers my question then. The specific question I had is if there is any way to use StyleCI and have the same validation checks locally.

I'd prefer to use StyleCI instead of phpcs since it's what they use for the framework code, that's all.

bobbybouwmann's avatar

As far as I know you can't run StyleCI locally. You might ask them if there is a way, but in the end using two tools will only give you headaches ;)

lorvent's avatar

@bobbybouwmann can you mind sharing your phpcs.xml file

also your .gitlab-ci.yml which is responsible for phpcs

Please or to participate in this conversation.