You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-26Lines changed: 26 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,12 +24,12 @@
24
24
25
25
## ✨ Features
26
26
27
-
-**Pre-configured Hooks:** Laravel Git Hooks comes with pre-configured pre-commit hooks for popular tools, such as Laravel Pint, PHPCS, ESLint, Prettier, Larastan, Enlightn, Rector, PHP Insights and Blade Formatter, making it easy to enforce coding standards and style guidelines right away.
27
+
-**Pre-configured Hooks:** Laravel Git Hooks comes with pre-configured pre-commit hooks for popular tools, such as Laravel Pint, PHPCS, ESLint, Prettier, Larastan, Enlightn, Rector, PHP Insights, and Blade Formatter, making it easy to enforce coding standards and style guidelines right away.
28
28
-**Manage Git Hooks:** Easily manage your Git hooks in your Laravel projects with a streamlined and organized approach.
29
29
-**Edit Commit Messages:** Gain control over your commit messages by customizing them to meet your project requirements and maintain a clean Git history.
30
30
-**Create Custom Hooks:** Add and integrate custom hooks tailored to your specific project needs, ensuring better code quality and adherence to guidelines.
31
-
-**Artisan Command for Hook Generation:** The package includes a convenient Artisan command that allows you to effortlessly generate new hooks of various types. Such as: `pre-commit`, `prepare-commit-msg`, `commit-msg`, `post-commit`, `pre-push`
32
-
-**Code Quality:** The package is thoroughly tested, with >95% of code coverage, ensuring its reliability and stability in a wide range of Laravel projects.
31
+
-**Artisan Command for Hook Generation:** The package includes a convenient Artisan command that allows you to effortlessly generate new hooks of various types, such as: `pre-commit`, `prepare-commit-msg`, `commit-msg`, `post-commit`, and `pre-push`.
32
+
-**Code Quality:** The package is thoroughly tested with >95% code coverage, ensuring its reliability and stability in a wide range of Laravel projects.
33
33
-**Docker support:** Each hook can be configured to either run locally or inside a Docker container, with full Laravel Sail integration.
34
34
-**Auto-fix Capabilities:** Automatically fix code issues without manual intervention, with configurable re-run after fixes.
35
35
@@ -42,21 +42,21 @@
42
42
composer require igorsgm/laravel-git-hooks --dev
43
43
```
44
44
45
-
- Publish the config file and customize it in the way you want:
45
+
- Publish the config file and customize it as needed:
- Now whenever you make a change in your `config/git-hooks.php` file, please register your git hooks by running the artisan command:
50
+
- Now, whenever you make a change to your `config/git-hooks.php` file, register your Git hooks by running the Artisan command:
51
51
```bash
52
52
php artisan git-hooks:register
53
53
```
54
54
55
55
Once you've configured and registered the hooks, you're all set!
56
56
57
57
## 2️⃣ General Usage
58
-
### Usage of the configured pre-commit hooks
59
-
To use the already created pre-commit hooks of this package, you can simply edit the `pre-commit` section of git-hooks.php config file. Here's an example of how to configure them:
58
+
### Usage of the configured Pre-commit Hooks
59
+
To use the pre-configured pre-commit hooks provided by this package, simply edit the `pre-commit` section of the `git-hooks.php` config file. Here's an example of how to configure them:
@@ -73,16 +73,16 @@ To use the already created pre-commit hooks of this package, you can simply edit
73
73
74
74
### 🔧 Auto-fix Capabilities
75
75
76
-
By default the pre-commit hooks will stop at first failure and will not continue with the remaining tools.
77
-
If the tool contains a fixer option it will prompt in the CLI to run the fix command.
76
+
By default, the pre-commit hooks will stop at the first failure and will not continue with the remaining tools.
77
+
If the tool contains a fixer option, it will prompt in the CLI to run the fix command.
78
78
79
79
The package includes powerful auto-fix functionality that can automatically resolve code style and formatting issues:
80
80
81
81
-**Interactive Fixing:** By default, when an issue is detected, you'll be prompted to run the fix command
82
82
-**Automatic Fixing:** Enable `automatically_fix_errors` to fix issues without prompts
83
83
-**Smart Re-running:** Enable `rerun_analyzer_after_autofix` to automatically verify fixes succeeded
84
84
85
-
This behavior can be adjusted using the following parameters from git-hooks.php config file:
85
+
This behavior can be adjusted using the following parameters from the `git-hooks.php` config file:
86
86
```php
87
87
// config/git-hooks.php
88
88
return [
@@ -95,19 +95,19 @@ return [
95
95
96
96
## 3️⃣ Advanced Usage
97
97
98
-
### 🐳 Laravel Sail support
98
+
### 🐳 Laravel Sail Support
99
99
100
-
If you are using Laravel Sail and maybe not local PHP is installed, you can adjust the following parameters in the `git-hooks.php` config file.
100
+
If you are using Laravel Sail and local PHP is not installed, you can adjust the following parameters in the `git-hooks.php` config file.
101
101
This will force the local git hooks to use the `sail` command to execute the hooks:
102
102
```php
103
103
// config/git-hooks.php
104
104
'use_sail' => env('GITHOOKS_USE_SAIL', false),
105
105
```
106
106
107
107
108
-
### 🐳 Docker support
108
+
### 🐳 Docker Support
109
109
110
-
By default, commands are executed locally, however this behavior can be adjusted for each hook using the parameters `run_in_docker` and `docker_container`:
110
+
By default, commands are executed locally; however, this behavior can be adjusted for each hook using the parameters `run_in_docker` and `docker_container`:
111
111
112
112
```php
113
113
// config/git-hooks.php
@@ -117,8 +117,8 @@ By default, commands are executed locally, however this behavior can be adjusted
The git-hooks.php config file offers several debug options that can be adjusted using the following parameters.
121
-
It also provides additional configuration options for fine-tuning hook behavior.
120
+
The `git-hooks.php` config file offers several debug options that can be adjusted using the following parameters.
121
+
It also provides additional configuration options for fine-tuning hook behavior:
122
122
123
123
```php
124
124
// config/git-hooks.php
@@ -143,14 +143,14 @@ return [
143
143
```
144
144
This command will prompt you to choose the type of hook you want to create (e.g., `pre-commit`, `post-commit`, etc.) and to provide a name forthe hook. Once you've provided the required information, the command will generate a new hook classin the `app/Console/GitHooks` directory.
145
145
2) To start using your custom hook, open the generated file and implement the `handle()` method with your desired logic.
146
-
3) Add your custom hook to the appropriate array in the git-hooks.php config file:
146
+
3) Add your custom hook to the appropriate array in the `git-hooks.php` config file:
class MyPostCommitHook implements \Igorsgm\GitHooks\Contracts\PostCommitHook
@@ -316,7 +316,7 @@ class MyPostCommitHook implements \Igorsgm\GitHooks\Contracts\PostCommitHook
316
316
317
317
### Pre-push Hook
318
318
> The pre-push hook runs during git push, after the remote refs have been updated but before any objects have been
319
-
transferred. It receives the name and location of the remote as parameters, and a list of to-be-updated refs through
319
+
>transferred. It receives the name and location of the remote as parameters, and a list of to-be-updated refs through
320
320
stdin. You can use it to validate a set of ref updates before a push occurs (a non-zero exit code will abort the push).
321
321
322
322
```php
@@ -330,7 +330,7 @@ return [
330
330
];
331
331
```
332
332
333
-
The class structure of the `pre-push` hooks is the same as the `post-commit` hook shown right above, but implementing `\Igorsgm\GitHooks\Contracts\PrePushHook` interface.
333
+
The class structure of the `pre-push` hooks is the same as the `post-commit` hook shown above, but implementing `\Igorsgm\GitHooks\Contracts\PrePushHook` interface.
334
334
335
335
## 🧪 Testing
336
336
@@ -340,10 +340,10 @@ composer test
340
340
341
341
## Changelog
342
342
343
-
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
343
+
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
0 commit comments