1
- # Madewithlove PHP-CS-Fixer configuration
1
+ <h1 align =" center " >
2
+ <br >
3
+ <img src =" https://static.madewithlove.com/logo/red/full.png " alt =" madewithlove " width =" 400 " >
4
+ <br ><br >
5
+ madewithlove PHP-CS-Fixer configuration
6
+ <br >
7
+ </h1 >
2
8
3
- The default [ PHP-CS-Fixer] ( https://github.com/FriendsOfPHP/PHP-CS-Fixer ) configuration for Madewithlove projects.
9
+ <h4 align =" center " >
10
+
11
+ The default [ PHP-CS-Fixer] ( https://github.com/FriendsOfPHP/PHP-CS-Fixer ) configuration for madewithlove projects.
12
+
13
+ </h4 >
14
+
15
+ <div align =" center " >
16
+
17
+ ![ ci] ( https://github.com/madewithlove/php-cs-fixer-config/actions/workflows/ci.yml/badge.svg )
18
+ [ ![ pull requests] ( https://img.shields.io/github/issues-pr/madewithlove/php-cs-fixer-config )] ( https://github.com/madewithlove/php-cs-fixer-config/pulls )
19
+ [ ![ contributors] ( https://img.shields.io/github/contributors/madewithlove/php-cs-fixer-config )] ( https://github.com/madewithlove/php-cs-fixer-config/graphs/contributors )
20
+
21
+ </div >
22
+
23
+ <div align =" center " >
24
+ <sub >Built with :heart : ︎ and :coffee : by heroes at <a href =" https://madewithlove.com " >madewithlove</a >.</sub >
25
+ </div >
4
26
5
27
## Installation
6
28
7
29
``` bash
8
- $ composer require madewithlove/php-cs-fixer-config
30
+ $ composer require madewithlove/php-cs-fixer-config --dev
9
31
```
10
32
11
33
## Usage
12
34
13
35
### Basic usage
14
36
15
- ** .php-cs-fixer.php**
37
+ ** ` .php-cs-fixer.php ` **
16
38
17
39
``` php
18
40
<?php
41
+
19
42
require 'vendor/autoload.php';
20
43
21
44
return Madewithlove\PhpCsFixer\Config::fromFolders(['src']);
@@ -25,6 +48,7 @@ To exclude a subfolder:
25
48
26
49
``` php
27
50
<?php
51
+
28
52
require 'vendor/autoload.php';
29
53
30
54
return Madewithlove\PhpCsFixer\Config::fromFolders(['src'], null, ['ignoreThisDir']);
@@ -33,10 +57,11 @@ This will skip `src/ignoreThisDir` or `src/foo/bar/ignoreThisDir`. (_The folder
33
57
34
58
You can also override rules per-project without overriding the core rules like this:
35
59
36
- ** .php-cs-fixer.php**
60
+ ** ` .php-cs-fixer.php ` **
37
61
38
62
``` php
39
63
<?php
64
+
40
65
require 'vendor/autoload.php';
41
66
42
67
return Madewithlove\PhpCsFixer\Config::fromFolders(['src'])->mergeRules([
@@ -48,21 +73,23 @@ return Madewithlove\PhpCsFixer\Config::fromFolders(['src'])->mergeRules([
48
73
49
74
You can also preconfigure the configuration for a Laravel project by calling a special factory method:
50
75
51
- ** .php-cs-fixer.php**
76
+ ** ` .php-cs-fixer.php ` **
52
77
53
78
``` php
54
79
<?php
80
+
55
81
require 'vendor/autoload.php';
56
82
57
83
return Madewithlove\PhpCsFixer\Config::forLaravel();
58
84
```
59
85
60
86
If need be, you can also append folders to fix in addition to Laravel's:
61
87
62
- ** .php-cs-fixer.php**
88
+ ** ` .php-cs-fixer.php ` **
63
89
64
90
``` php
65
91
<?php
92
+
66
93
require 'vendor/autoload.php';
67
94
68
95
return Madewithlove\PhpCsFixer\Config::forLaravel(['some_other_folder']);
@@ -74,14 +101,16 @@ By default, the configuration will check the version of PHP you run the tool wit
74
101
75
102
You can override the _ target_ PHP version by passing it either as constructor argument, or as second argument to ` fromFolders ` :
76
103
77
- ** .php-cs-fixer.php**
104
+ ** ` .php-cs-fixer.php ` **
78
105
79
106
``` php
80
107
<?php
108
+
81
109
require 'vendor/autoload.php';
82
110
83
111
return Madewithlove\PhpCsFixer\Config::fromFolders(['src'], '7.4');
84
112
85
- // Or
113
+ // or
114
+
86
115
return Madewithlove\PhpCsFixer\Config::forLaravel([], '7.4');
87
116
```
0 commit comments