pint icon indicating copy to clipboard operation
pint copied to clipboard

feat: add support for user-defined presets via composer

Open calebdw opened this issue 6 months ago • 0 comments

Hello!

This allows users to create and distribute custom presets through composer packages, enabling better code style sharing across projects. I also updated pint to use the new preset manifest system so there's a unified method of registering presets.

Presets are added in the composer extra section like so:

    "extra": {
        "laravel-pint": {
            "presets": {
                "laravel": "resources/presets/laravel.php",
                "per": "resources/presets/per.php",
                "psr12": "resources/presets/psr12.php",
                "symfony": "resources/presets/symfony.php",
                "empty": "resources/presets/empty.php"
            }
        }
    },

[!NOTE] I'm aware that it's possible to pass a custom config file like ./vendor/bin/pint --config vendor/my-company/coding-style/pint.json, however, it's much nicer to be able to simple define a custom company preset which then is referenced in all pint configs

This also adds a new preset:list command to show all available presets:

image

Thanks!

calebdw avatar Aug 08 '25 05:08 calebdw