|
2 | 2 |
|
3 | 3 | [CodeIgniter](https://codeigniter.com) 4 coding standard for use with [PHP_CodeSniffer 3](https://github.com/squizlabs/PHP_CodeSniffer). |
4 | 4 |
|
5 | | -Version 1.0.0-beta0008 |
| 5 | +Version 1.0.0-beta0009 |
6 | 6 |
|
7 | 7 | | Master | Develop | |
8 | 8 | | :---: | :---: | |
@@ -34,34 +34,84 @@ Set the `phpcs standard path` and `phpcbf standard path` in your editor/plugin c |
34 | 34 |
|
35 | 35 | ### Download install |
36 | 36 |
|
37 | | -Download [CodeIgniter4-Standard](https://github.com/louisl/CodeIgniter4-Standard/archive/v1.0.0-beta0008.zip). |
| 37 | +Download [CodeIgniter4-Standard](https://github.com/louisl/CodeIgniter4-Standard/archive/v1.0.0-beta0009.zip). |
38 | 38 |
|
39 | 39 | Set `standard ` paths to your local filesystem: |
40 | 40 |
|
41 | 41 | `'/Path/To/CodeIgniter4-Standard/CodeIgniter4/ruleset.xml'` |
42 | 42 |
|
| 43 | +### Global install |
| 44 | + |
| 45 | +Globally [install PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer/blob/master/README.md) with one of the various methods. |
| 46 | + |
| 47 | +Once complete you should be able to execute `phpcs -i` on the command line. |
| 48 | + |
| 49 | +You should see something like:- |
| 50 | + |
| 51 | +`The installed coding standards are MySource, PEAR, PSR1, PSR2, Squiz and Zend.` |
| 52 | + |
| 53 | +Either clone this repository... |
| 54 | + |
| 55 | +`git clone -b master --depth 1 https://github.com/louisl/CodeIgniter4-Standard.git`. |
| 56 | + |
| 57 | +or use composer... |
| 58 | + |
| 59 | +`composer global require louisl/codeigniter4-standard` |
| 60 | + |
| 61 | +or download. |
| 62 | + |
| 63 | +Take note of the paths where they were installed. |
| 64 | + |
| 65 | +Create a symbolic link to the `CodeIgniter4-Standard/CodeIgniter4` directory in `php_codesniffer/src/Standards/` eg. |
| 66 | + |
| 67 | +`ln -s ~/Documents/Projects/CodeIgniter4-Standard/CodeIgniter4 ~/.composer/vendor/squizlabs/php_codesniffer/src/Standards/CodeIgniter4` |
| 68 | + |
| 69 | +or copy the `CodeIgniter4-Standard/CodeIgniter4` directory to `php_codesniffer/src/Standards/` |
| 70 | + |
| 71 | +Executing `phpcs -i` should now show CodeIgniter4 installed eg. |
| 72 | + |
| 73 | +`The installed coding standards are CodeIgniter4, MySource, PEAR, PSR1, PSR2, Squiz and Zend.` |
| 74 | + |
| 75 | +You should now be able to set 'CodeIgniter4' as the phpcs standard in the plugin/editor/IDE of your choice. |
| 76 | + |
43 | 77 | ### Command line use |
44 | 78 |
|
45 | 79 | #### Sniffing errors & warnings (reporting). |
46 | 80 |
|
47 | | -Single file. |
| 81 | +Single file... |
48 | 82 |
|
49 | 83 | `phpcs /Path/To/MyFile.php --standard='/Path/To/CodeIgniter4-Standard/CodeIgniter4/ruleset.xml'` |
50 | 84 |
|
| 85 | +or if globally installed. |
| 86 | + |
| 87 | +`phpcs /Path/To/MyFile.php --standard=CodeIgniter4` |
| 88 | + |
51 | 89 | Directory (recursive). |
52 | 90 |
|
53 | 91 | `phpcs /Path/To/MyProject --standard='/Path/To/CodeIgniter4-Standard/CodeIgniter4/ruleset.xml'` |
54 | 92 |
|
| 93 | +or if globally installed. |
| 94 | + |
| 95 | +`phpcs /Path/To/MyProject --standard=CodeIgniter4` |
| 96 | + |
55 | 97 | #### Fixing fixable errors. |
56 | 98 |
|
57 | 99 | Single file. |
58 | 100 |
|
59 | 101 | `phpcbf /Path/To/MyFile.php --standard='/Path/To/CodeIgniter4-Standard/CodeIgniter4/ruleset.xml'` |
60 | 102 |
|
| 103 | +or if globally installed. |
| 104 | + |
| 105 | +`phpcbf /Path/To/MyFile.php --standard=CodeIgniter4` |
| 106 | + |
61 | 107 | Directory (recursive). |
62 | 108 |
|
63 | 109 | `phpcbf /Path/To/MyProject --standard='/Path/To/CodeIgniter4-Standard/CodeIgniter4/ruleset.xml'` |
64 | 110 |
|
| 111 | +or if globally installed. |
| 112 | + |
| 113 | +`phpcbf /Path/To/MyProject --standard=CodeIgniter4` |
| 114 | + |
65 | 115 | ## Example editor configs |
66 | 116 |
|
67 | 117 | ### SublimeText project config |
|
0 commit comments