Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
146 lines (132 loc) · 13 KB
/
Copy pathindex.html
File metadata and controls
146 lines (132 loc) · 13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PhpMetrics: see which PHP code will hurt you next</title>
<meta name="description" content="PhpMetrics draws your PHP project as a map of complexity and maintainability. One command, a report you open in your browser, and the risky code is the first thing you see.">
<meta property="og:title" content="PhpMetrics">
<meta property="og:description" content="See which PHP code will hurt you next. One command, one report, nothing leaves your machine.">
<meta property="og:image" content="https://phpmetrics.github.io/assets/og.png">
<meta property="og:url" content="https://phpmetrics.github.io/">
<meta name="twitter:card" content="summary_large_image">
<link rel="canonical" href="https://phpmetrics.github.io/">
<link rel="icon" href="/assets/logo.png">
<link rel="stylesheet" href="/assets/site.css">
</head>
<body>
<header class="bar">
<div class="bar-inner">
<a class="brand" href="/"><img src="/assets/logo.png" alt="">PhpMetrics</a>
<nav>
<a href="/docs/">Docs</a>
<a href="/docs/#metrics">Metrics</a>
<a href="https://github.com/phpmetrics/PhpMetrics">GitHub</a>
</nav>
</div>
</header>
<main>
<section class="hero">
<div class="wrap hero-grid">
<div>
<h1>See which code will hurt you <span>next.</span></h1>
<p class="lead">PhpMetrics draws your PHP project. Every class becomes a circle: bigger when it is complex, redder when it is hard to maintain. Run one command and the code that needs you is the first thing you see.</p>
<div class="term">
<button class="copy" data-copy="composer require --dev phpmetrics/phpmetrics vendor/bin/phpmetrics --report-html=report src">Copy</button>
<pre><span class="p">$ </span>composer require --dev phpmetrics/phpmetrics
<span class="p">$ </span>vendor/bin/phpmetrics --report-html=report src
<span class="c"> Open report/index.html. That's all.</span></pre>
</div>
<div class="actions">
<a class="btn btn-primary" href="/docs/">Get started</a>
<a class="btn btn-ghost" href="https://github.com/phpmetrics/PhpMetrics">View on GitHub →</a>
</div>
</div>
<div class="hero-visual cluster">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-185 -185 370 370" role="img" aria-label="Classes drawn as circles: the bigger the circle, the more complex the class; red means hard to maintain."><circle cx="0.0" cy="0.0" r="3.6" fill="#45b36b" style="--i:0"/><circle cx="9.8" cy="0.0" r="3.7" fill="#45b36b" style="--i:1"/><circle cx="-4.9" cy="8.5" r="3.7" fill="#45b36b" style="--i:2"/><circle cx="-8.5" cy="-4.9" r="3.7" fill="#45b36b" style="--i:3"/><circle cx="4.9" cy="-8.6" r="3.8" fill="#45b36b" style="--i:4"/><circle cx="5.2" cy="9.0" r="4.0" fill="#45b36b" style="--i:5"/><circle cx="-13.9" cy="3.7" r="4.0" fill="#f5b041" style="--i:6"/><circle cx="-3.9" cy="-14.1" r="4.1" fill="#45b36b" style="--i:7"/><circle cx="15.2" cy="-8.7" r="4.1" fill="#f5b041" style="--i:8"/><circle cx="15.9" cy="8.4" r="4.3" fill="#45b36b" style="--i:9"/><circle cx="-0.7" cy="18.0" r="4.3" fill="#45b36b" style="--i:10"/><circle cx="-13.5" cy="14.8" r="4.6" fill="#45b36b" style="--i:11"/><circle cx="-19.2" cy="-6.0" r="4.6" fill="#45b36b" style="--i:12"/><circle cx="5.9" cy="-19.5" r="4.6" fill="#45b36b" style="--i:13"/><circle cx="11.0" cy="19.0" r="4.9" fill="#45b36b" style="--i:14"/><circle cx="-15.0" cy="-17.4" r="5.0" fill="#45b36b" style="--i:15"/><circle cx="23.6" cy="-0.6" r="5.1" fill="#45b36b" style="--i:16"/><circle cx="-24.5" cy="9.0" r="5.3" fill="#45b36b" style="--i:17"/><circle cx="-4.9" cy="-26.3" r="5.7" fill="#45b36b" style="--i:18"/><circle cx="18.7" cy="-20.4" r="5.7" fill="#45b36b" style="--i:19"/><circle cx="-9.5" cy="27.1" r="5.9" fill="#45b36b" style="--i:20"/><circle cx="24.5" cy="18.1" r="6.2" fill="#45b36b" style="--i:21"/><circle cx="4.6" cy="31.1" r="6.3" fill="#f5b041" style="--i:22"/><circle cx="-32.3" cy="-2.9" r="6.4" fill="#45b36b" style="--i:23"/><circle cx="31.0" cy="-12.5" r="6.4" fill="#45b36b" style="--i:24"/><circle cx="-24.1" cy="23.4" r="6.6" fill="#f5b041" style="--i:25"/><circle cx="8.5" cy="-33.4" r="7.0" fill="#45b36b" style="--i:26"/><circle cx="-29.7" cy="-18.7" r="7.2" fill="#45b36b" style="--i:27"/><circle cx="36.3" cy="7.3" r="7.4" fill="#45b36b" style="--i:28"/><circle cx="-19.3" cy="-32.5" r="7.5" fill="#45b36b" style="--i:29"/><circle cx="20.7" cy="33.9" r="7.5" fill="#45b36b" style="--i:30"/><circle cx="-39.7" cy="11.8" r="7.6" fill="#f5b041" style="--i:31"/><circle cx="25.6" cy="-34.7" r="7.7" fill="#45b36b" style="--i:32"/><circle cx="-6.9" cy="43.0" r="7.7" fill="#45b36b" style="--i:33"/><circle cx="-5.4" cy="-43.6" r="7.7" fill="#45b36b" style="--i:34"/><circle cx="39.6" cy="24.7" r="7.8" fill="#45b36b" style="--i:35"/><circle cx="-24.7" cy="40.3" r="7.8" fill="#45b36b" style="--i:36"/><circle cx="47.0" cy="-7.1" r="8.0" fill="#45b36b" style="--i:37"/><circle cx="-47.0" cy="-12.4" r="8.7" fill="#45b36b" style="--i:38"/><circle cx="43.1" cy="-26.3" r="9.1" fill="#45b36b" style="--i:39"/><circle cx="11.1" cy="50.5" r="9.2" fill="#45b36b" style="--i:40"/><circle cx="-38.9" cy="-36.1" r="9.9" fill="#45b36b" style="--i:41"/><circle cx="-43.5" cy="31.8" r="10.3" fill="#45b36b" style="--i:42"/><circle cx="14.9" cy="-52.1" r="10.3" fill="#45b36b" style="--i:43"/><circle cx="56.2" cy="12.1" r="10.5" fill="#f5b041" style="--i:44"/><circle cx="-23.8" cy="-53.4" r="10.6" fill="#45b36b" style="--i:45"/><circle cx="37.8" cy="45.5" r="10.6" fill="#45b36b" style="--i:46"/><circle cx="-59.4" cy="5.5" r="10.6" fill="#45b36b" style="--i:47"/><circle cx="-18.6" cy="60.4" r="10.7" fill="#45b36b" style="--i:48"/><circle cx="41.3" cy="-48.6" r="10.8" fill="#45b36b" style="--i:49"/><circle cx="-3.9" cy="-66.6" r="10.9" fill="#45b36b" style="--i:50"/><circle cx="64.5" cy="-19.4" r="10.9" fill="#45b36b" style="--i:51"/><circle cx="-61.6" cy="-29.4" r="11.2" fill="#f5b041" style="--i:52"/><circle cx="60.2" cy="36.0" r="11.3" fill="#f5b041" style="--i:53"/><circle cx="-42.6" cy="55.9" r="11.3" fill="#45b36b" style="--i:54"/><circle cx="3.0" cy="72.0" r="11.3" fill="#f5b041" style="--i:55"/><circle cx="27.7" cy="67.7" r="11.3" fill="#45b36b" style="--i:56"/><circle cx="-67.5" cy="28.6" r="11.4" fill="#45b36b" style="--i:57"/><circle cx="-48.1" cy="-58.4" r="11.7" fill="#e5484d" style="--i:58"/><circle cx="30.4" cy="-71.2" r="11.8" fill="#45b36b" style="--i:59"/><circle cx="79.3" cy="1.8" r="12.4" fill="#f5b041" style="--i:60"/><circle cx="-79.8" cy="-10.3" r="12.7" fill="#f5b041" style="--i:61"/><circle cx="67.2" cy="-45.5" r="12.8" fill="#45b36b" style="--i:62"/><circle cx="-27.0" cy="-79.1" r="12.9" fill="#e5484d" style="--i:63"/><circle cx="57.6" cy="62.9" r="13.2" fill="#45b36b" style="--i:64"/><circle cx="-34.5" cy="81.9" r="13.5" fill="#f5b041" style="--i:65"/><circle cx="-70.4" cy="56.3" r="14.0" fill="#45b36b" style="--i:66"/><circle cx="9.6" cy="-90.8" r="14.3" fill="#e5484d" style="--i:67"/><circle cx="87.7" cy="29.8" r="14.4" fill="#f5b041" style="--i:68"/><circle cx="-76.6" cy="-53.5" r="14.7" fill="#f5b041" style="--i:69"/><circle cx="-93.5" cy="16.5" r="14.9" fill="#f5b041" style="--i:70"/><circle cx="59.5" cy="-74.8" r="15.0" fill="#45b36b" style="--i:71"/><circle cx="92.6" cy="-25.3" r="15.3" fill="#45b36b" style="--i:72"/><circle cx="19.8" cy="95.8" r="15.3" fill="#45b36b" style="--i:73"/><circle cx="-57.8" cy="-87.6" r="16.6" fill="#f5b041" style="--i:74"/><circle cx="-13.0" cy="106.7" r="16.8" fill="#f5b041" style="--i:75"/><circle cx="-103.2" cy="-32.3" r="16.9" fill="#f5b041" style="--i:76"/><circle cx="55.3" cy="96.1" r="17.6" fill="#45b36b" style="--i:77"/><circle cx="90.9" cy="64.2" r="17.6" fill="#f5b041" style="--i:78"/><circle cx="112.7" cy="4.9" r="18.5" fill="#f5b041" style="--i:79"/><circle cx="-18.9" cy="-112.5" r="19.0" fill="#f5b041" style="--i:80"/><circle cx="-68.3" cy="92.1" r="19.4" fill="#45b36b" style="--i:81"/><circle cx="42.1" cy="-107.6" r="19.7" fill="#f5b041" style="--i:82"/><circle cx="97.9" cy="-62.4" r="19.7" fill="#f5b041" style="--i:83"/><circle cx="-108.0" cy="52.4" r="21.4" fill="#f5b041" style="--i:84"/><circle cx="-129.3" cy="-0.1" r="22.0" fill="#f5b041" style="--i:85"/><circle cx="-101.2" cy="-87.0" r="24.4" fill="#e5484d" style="--i:86"/><circle cx="17.5" cy="138.0" r="24.5" fill="#e5484d" style="--i:87"/><circle cx="131.7" cy="46.2" r="24.5" fill="#f5b041" style="--i:88"/><circle cx="136.6" cy="-34.8" r="25.3" fill="#f5b041" style="--i:89"/><circle cx="90.2" cy="-110.1" r="26.0" fill="#e5484d" style="--i:90"/><circle cx="-48.0" cy="135.7" r="26.3" fill="#e5484d" style="--i:91"/><circle cx="-62.2" cy="-132.8" r="26.3" fill="#f5b041" style="--i:92"/><circle cx="14.3" cy="-150.7" r="29.1" fill="#f5b041" style="--i:93"/><circle cx="102.7" cy="113.2" r="30.3" fill="#f5b041" style="--i:94"/></svg>
</div>
</div>
</section>
<section class="shot">
<div class="wrap">
<div class="narrow center">
<h2>Your whole project on a single page.</h2>
<p class="lead">Size, complexity, coupling, the classes everything else depends on, and the rules your code already breaks. Hand it to a new hire, to your CTO, or to yourself after six months away.</p>
</div>
<div class="frame">
<div class="frame-top"><i></i><i></i><i></i></div>
<img src="/assets/report.webp" alt="The PhpMetrics HTML report: a summary of violations, lines of code and classes, and a chart where each class is a circle sized by complexity and coloured by maintainability." width="2400" height="1500" loading="lazy">
</div>
</div>
</section>
<section>
<div class="wrap">
<div class="story">
<div>
<h2>Start with the big red circles.</h2>
<p class="lead">A class that is both complex and hard to maintain is where bugs hide and estimates slip. The report shows you which ones, and tells you why: cyclomatic complexity, lack of cohesion, coupling, the probable number of bugs.</p>
</div>
<div class="visual legend">
<div><span class="dot" style="width:64px;height:64px;background:#e5484d"></span><span><b>Large and red.</b> Complex, hard to change. Look here first.</span></div>
<div><span class="dot" style="width:40px;height:40px;background:#f5b041;margin:0 12px"></span><span><b>Amber.</b> Worth watching.</span></div>
<div><span class="dot" style="width:22px;height:22px;background:#45b36b;margin:0 21px"></span><span><b>Small and green.</b> Leave it alone.</span></div>
</div>
</div>
<div class="story">
<div class="visual">
<pre class="code"><span class="k">searches</span>:
<span class="k">Repository calling a service</span>:
<span class="k">type</span>: class
<span class="k">nameMatches</span>: <span class="s">".*Repository.*"</span>
<span class="k">usesClasses</span>: [<span class="s">".*Service"</span>]
<span class="k">failIfFound</span>: true
<span class="k">Class too complex</span>:
<span class="k">type</span>: class
<span class="k">ccn</span>: <span class="s">">=10"</span>
<span class="k">failIfFound</span>: true</pre>
</div>
<div>
<h2>Then make sure it stays fixed.</h2>
<p class="lead">Write down the rules your architecture should follow. When a pull request breaks one, the build fails and says which class did it.</p>
<p class="lead">Violations are also written in the PMD format, which your CI already knows how to read.</p>
</div>
</div>
<div class="story">
<div>
<h2>Your code stays home.</h2>
<p class="lead">No account, no upload, no server to trust. PhpMetrics reads your code on your machine and writes a folder of plain HTML that opens without a connection.</p>
<p class="lead">The one request it makes asks Packagist whether your Composer dependencies are up to date. A single flag turns it off.</p>
</div>
<div class="visual">
<pre class="code"><span class="c"># nothing leaves this machine</span>
vendor/bin/phpmetrics \
--composer=false \
--report-html=report src</pre>
</div>
</div>
</div>
</section>
<section class="closing">
<div class="wrap narrow center">
<h2>Free, since 2013.</h2>
<p class="lead">PhpMetrics is open source under the MIT license and maintained on spare time. If it saves you some of yours, a star helps other developers find it, and sponsorship pays for the next release.</p>
<div class="actions">
<a class="btn btn-primary" href="https://github.com/phpmetrics/PhpMetrics">Star on GitHub</a>
<a class="btn btn-ghost" href="https://github.com/sponsors/Halleck45">Sponsor →</a>
</div>
</div>
</section>
</main>
<footer>
<div class="wrap">
<span>PhpMetrics, by <a href="https://github.com/Halleck45">Jean-François Lépine</a> and contributors. MIT license.</span>
<nav>
<a href="/docs/">Docs</a>
<a href="https://github.com/phpmetrics/PhpMetrics/releases">Releases</a>
<a href="https://github.com/phpmetrics/PhpMetrics/issues">Issues</a>
</nav>
</div>
</footer>
<script src="/assets/site.js" defer></script>
</body>
</html>