hungthai1401/grumphp-pint-task

Laravel Pint task runner from GrumPHP

v0.0.2 2022-12-31 15:34 UTC

This package is auto-updated.

Last update: 2024-04-29 04:54:08 UTC


README

This package extends GrumPHP with a task that runs Laravel Pint for your Laravel projects.

Installation

The easiest way to install this package is through composer:

composer require --dev hungthai1401/grumphp-pint-task

Config

Add the extension loader to your grumphp.yml or grumphp.yml.dist. The task lives under the laravel_pint namespace and has following configurable parameters:

grumphp:
  tasks:
    laravel_pint:
      config: 'pint.json'
      files_on_pre_commit: false
      paths: ['src']
  extensions:
    - HT\GrumPhpPintTask\ExtensionLoader

By default, this won't update your code, you need to do it manually.

config

Default: 'pint.json'

If you want to use a different config file than the default pint.json, you can specify your custom config file location with this option.

files_on_pre_commit

Default: false

This option makes it possible to use the changed files as paths during pre-commits. It will use the paths option to make sure only committed files that match the path are validated.

paths

Default: []

Can only be used when files_on_pre_commit=false

If you want to run on particular directories only, specify it with this option.

Sample Laravel Pint configuration

Create pint.json in your project root and configure as follows. This example file I am using for my Laravel project. Also you no need to set all these settings, please add or remove as per your requirements.

{
  "preset": "laravel",
  "rules": {
    "concat_space": {
      "spacing": "one"
    },
    "fully_qualified_strict_types": true,
    "global_namespace_import": {
      "import_constants": true,
      "import_functions": true,
      "import_classes": true
    }
  }
}

Please visit Laravel Pint for more configuration examples.

Uninstall

If you want to uninstall this extension remove configuration files first: pint.json from your application, then remove package:

composer remove hungthai1401/grumphp-pint-task

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

The MIT License (MIT). Please see License File for more information.