@@ -5,31 +5,123 @@ Development toolkit for CodeIgniter libraries and projects
55
66* Install via Composer: ` > composer require --dev codeigniter4/devkit `
77
8- ## Included
8+ ## Included Dependencies
99
1010### Styles and Standards
1111
1212* [ CodeIgniter Coding Standard] ( https://github.com/CodeIgniter/coding-standard )
13- * NexusPHP CS Config
13+ * [ NexusPHP CS Config] ( https://github.com/NexusPHP/cs-config )
1414
1515### Testing and Analysis
1616
17- * NexusPHP Tachycardia
18- * PHPStan
19- * PHPUnit
17+ * [ NexusPHP Tachycardia] ( https://github.com/NexusPHP/tachycardia )
18+ * [ PHPStan] ( https://phpstan.org/user-guide/getting-started )
19+ * [ PHPUnit] ( http://phpunit.readthedocs.io )
2020
2121### Mocking
2222
23- * FakerPHP
24- * VFS Stream
23+ * [ FakerPHP] ( https://fakerphp.github.io )
24+ * [ VFS Stream] ( https://github.com/bovigo/vfsStream/wiki )
2525
26- ## Additional Tools
26+ ### Security
2727
28- These are integrated into the workflows but not included via Composer so need to be installed separately.
29- All of them are available via [ Phive] ( https://phar.io/#Tools ) .
28+ * [ Dependabot] ( https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/about-dependabot-version-updates )
29+ * [ Roave Security Advisories] ( https://github.com/Roave/SecurityAdvisories )
30+
31+ ### Additional Tools
32+
33+ These are integrated into the workflows but not included via Composer. If you want to use them
34+ locally they will need to be installed. All of them are available via [ Phive] ( https://phar.io/#Tools ) .
3035
3136* [ Composer Normalize] ( https://github.com/ergebnis/composer-normalize )
3237* [ Composer Unused] ( https://github.com/composer-unused/composer-unused )
38+ * [ Deptrac] ( https://github.com/qossmic/deptrac )
3339* [ Infection] ( https://infection.github.io/ )
3440* [ PHP Coveralls] ( https://php-coveralls.github.io/php-coveralls/ )
3541* [ PHP CS Fixer] ( https://cs.symfony.com/ )
42+
43+ ## Source Files
44+
45+ The provided source files should be considered guidelines or templates for your own use, as
46+ they may need changing to fit your environment. These are based on the following assumptions:
47+
48+ 1 . Your default repository branch is set to ` develop `
49+ 2 . You use Composer to manage all necessary dependencies
50+ 3 . Your source code is located in ** app/** (for projects) or ** src/** (for libraries)
51+ 4 . Your unit tests are located in ** tests/**
52+ 5 . Your CodeIgniter dependency is ` codeigniter4/framework ` (some paths need to be changed for ` dev-develop ` )
53+
54+ ### Workflows
55+
56+ This kit includes a number of workflow templates for integrating [ GitHub Actions] ( https://docs.github.com/en/actions )
57+ into your library or project development process. To add these to your repo simply copy the
58+ workflows into a ** .github/workflows/** directory.
59+
60+ > Hint: the [ source files] ( src/.github ) also include a configuration for Dependabot which will help keep your dependencies and workflows updated.
61+
62+ Below is a brief description of each workflow; see the links above for help with each tool.
63+
64+ #### Deptrac
65+
66+ * Requires ** depfile.yaml***
67+
68+ Deptrac is a "dependency tracing" tool that allows developers to define which components should
69+ be allowed to access each other. This helps keep your project architecture logical and concise
70+ by enforcing the rules you set. For example, you may want to impose an MVC-style architecture
71+ by allowing a ` Controller ` to use any ` Model ` but not vice-versa.
72+
73+ #### Infection
74+
75+ * Requires ** infection.json.dist***
76+
77+ Just because your tests reach a high level of code coverage does not mean they are comprehensive.
78+ Mutation Testing is a way of gauging the * quality* of your unit tests. A silly example: your
79+ code has an increment function with a single unit test for 100% coverage:
80+
81+ ``` php
82+ function increment(int $num1, int $num2): int
83+ {
84+ return $num1 + $num2;
85+ }
86+
87+ function testIncrementWithZero()
88+ {
89+ $result = increment(42, 0);
90+ $this->assertSame(42, $result);
91+ }
92+ ```
93+
94+ Infection will re-run your unit test against "mutated" versions of your code that * should*
95+ cause failures and report "escaped mutations" when they still pass. In this example, Infection
96+ mutates your ` increment() ` function to use ` - ` instead of ` + ` , but since your test case
97+ still asserts ` 42 ` as the result it is considered an "escape" and you should plan to add
98+ more tests.
99+
100+ #### PHPCPD
101+
102+ PHP Copy-Paste Detector analyzes your code and reports when there are blocks of duplicate code
103+ more than a certain number of lines long (default: 5). In most cases this is a sign of poor
104+ code structure and an opportunity to consolidate classes or functions.
105+
106+ #### PHPStan
107+
108+ * Requires ** phpstan.neon.dist***
109+
110+ Static analysis is a major factor in catching bugs and issues before they happen. PHPStan will
111+ analyze your code for mistakes based on the configuration supplied.
112+
113+ #### PHPUnit
114+
115+ * Requires ** phpunit.xml.dist***
116+
117+ Unit testing automates running your code through all the possible scenarios before putting it
118+ into use in production. PHPUnit is a highly-configurable framework and suite for writing and
119+ running unit tests. This workflow also configures PHPUnit to report on code coverage and
120+ upload the results to [ Coveralls.io] ( https://coveralls.io ) (you will need a free account,
121+ but it is also fine to use this workflow without Coveralls).
122+
123+ #### Unused
124+
125+ Composer Unused does one thing: checks that your code actually uses the dependencies you
126+ have included via Composer. It can be easy to forget to update your ** composer.json** when
127+ your code drops a dependency, so this workflow will help track those down.
0 commit comments