Sublime Forum

What php quality tools you use

#1

I write php, js, html, jquery, and also laravel and vue

how can I make sublime to help me to make the code prettier
like clean variable names to CamelCase
and have the code have line changes {
and so on ?

0 Likes

#2

I installed now jsprettier: https://packagecontrol.io/packages/JsPrettier
and https://github.com/prettier/plugin-php

but it’s making awful linechange after the (
if (
strcasecmp(trim($_POST[’_extr…

and using tabs instead of spaces

how can I change it’s settings?

And it also puts every parameter to newline, which if awful also:
setcookie(
$COOKIE_NAME,
“jepjep”,
mktime(0, 0, 0, 12, 31, 2032),
“/”
);

0 Likes

#3

At a project level, I actually prefer an external script/command to do the job which is editor-independent and highly customize-able for sure… I mean that I do not do this in ST for a project.

For example, for PHP, in composer.json:

{
    "scripts": {
        "analyze": [
            "phan --color",
            "phpcs --colors -n"
        ],
        "fix": [
            "php-cs-fixer fix --verbose"
        ],
        "test": [
            "phpunit --verbose"
        ]
    }
}

I will run $ composer fix in CI or whenever I want to fix coding style for the whole project. I don’t really use a “prettifier” at this moment.


Similarly, for JS, in packages.json


Or, shell scripts for anything general.

0 Likes

#4

I just use SublimePHPIntel

0 Likes