Skip to content

Commit 0a90b39

Browse files
committed
remake
0 parents  commit 0a90b39

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+8842
-0
lines changed

.gitattributes

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
phpcs.xml export-ignore
2+
phpstan.neon export-ignore
3+
.gitattributes export-ignore
4+
.gitignore export-ignore
5+
package.json export-ignore
6+
tsconfig.json export-ignore
7+
webpack.config.js export-ignore
8+
assets/ export-ignore
9+
.github/ export-ignore
10+
node_modules/ export-ignore
11+
vendor/ export-ignore
12+
tests/ export-ignore
13+
phpcs.xml.dist export-ignore

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [arrayiterator]

.github/workflows/code-checking.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: "Code Checking"
2+
3+
on: [
4+
push,
5+
pull_request
6+
]
7+
8+
jobs:
9+
code-checking-php74:
10+
name: "Code Checking php7.4"
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: "Checkout"
14+
uses: actions/checkout@master
15+
- name: "Install Php 7.4"
16+
uses: shivammathur/setup-php@v2
17+
with:
18+
php-version: '7.4'
19+
tools: composer:v2
20+
extensions: json, intl
21+
- name: "Validate composer.json"
22+
run: php $(which composer) validate --strict
23+
- name: "Install dependencies with composer"
24+
run: php $(which composer) install --no-interaction --no-progress
25+
- name: "Run PHP CodeSniffer"
26+
run: php vendor/bin/phpcs --standard=phpcs.xml
27+
- name: "Run PHPStan"
28+
run: php vendor/bin/phpstan analyse
29+
code-checking-php81:
30+
name: "Code Checking php8.1"
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: "Checkout"
34+
uses: actions/checkout@master
35+
- name: "Install Php 8.1"
36+
uses: shivammathur/setup-php@v2
37+
with:
38+
php-version: '8.1'
39+
tools: composer:v2
40+
extensions: json, intl
41+
- name: "Validate composer.json"
42+
run: php $(which composer) validate --strict
43+
- name: "Install dependencies with composer"
44+
run: php $(which composer) install --no-interaction --no-progress
45+
- name: "Run PHP CodeSniffer"
46+
run: php vendor/bin/phpcs --standard=phpcs.xml
47+
- name: "Run PHPStan"
48+
run: php vendor/bin/phpstan analyse
49+
code-checking-php82:
50+
name: "Code Checking php8.2"
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: "Checkout"
54+
uses: actions/checkout@master
55+
- name: "Install Php 8.2"
56+
uses: shivammathur/setup-php@v2
57+
with:
58+
php-version: '8.2'
59+
tools: composer:v2
60+
extensions: json, intl
61+
- name: "Validate composer.json"
62+
run: php $(which composer) validate --strict
63+
- name: "Install dependencies with composer"
64+
run: php $(which composer) install --no-interaction --no-progress
65+
- name: "Run PHP CodeSniffer"
66+
run: php vendor/bin/phpcs --standard=phpcs.xml
67+
- name: "Run PHPStan"
68+
run: php vendor/bin/phpstan analyse
69+
code-checking-php83:
70+
name: "Code Checking php8.3"
71+
runs-on: ubuntu-latest
72+
steps:
73+
- name: "Checkout"
74+
uses: actions/checkout@master
75+
- name: "Install Php 8.3"
76+
uses: shivammathur/setup-php@v2
77+
with:
78+
php-version: '8.3'
79+
tools: composer:v2
80+
extensions: json, intl
81+
- name: "Validate composer.json"
82+
run: php $(which composer) validate --strict
83+
- name: "Install dependencies with composer"
84+
run: php $(which composer) install --no-interaction --no-progress
85+
- name: "Run PHP CodeSniffer"
86+
run: php vendor/bin/phpcs --standard=phpcs.xml
87+
- name: "Run PHPStan"
88+
run: php vendor/bin/phpstan analyse

.gitignore

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Files that might appear in the root of a volume
2+
.DocumentRevisions-V100
3+
.fseventsd
4+
.Spotlight-V100
5+
.TemporaryItems
6+
.Trashes
7+
.VolumeIcon.icns
8+
.DS_Store
9+
10+
11+
# Windows Installer files
12+
*.cab
13+
*.msi
14+
*.msm
15+
*.msp
16+
*.exe
17+
18+
# Windows shortcuts
19+
*.lnk
20+
21+
#
22+
# =================================
23+
# Gitignore For Linux OS
24+
# =================================
25+
26+
# KDE directory preferences
27+
.directory
28+
29+
#
30+
# =================================
31+
# Gitignore For Jetbrain
32+
# =================================
33+
34+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
35+
*.iml
36+
37+
# Directory-based project format:
38+
#.idea/*.xml
39+
.idea/
40+
41+
# File-based project format:
42+
*.ipr
43+
*.iws
44+
45+
# JIRA plugin
46+
atlassian-ide-plugin.xml
47+
48+
#
49+
# =================================
50+
# Gitignore For Text Editor
51+
# =================================
52+
53+
# cache files for sublime text
54+
*.tmlanguage.cache
55+
*.tmPreferences.cache
56+
*.stTheme.cache
57+
58+
# workspace files are user-specific
59+
*.sublime-workspace
60+
61+
# project files should be checked into the repository, unless a significant
62+
# proportion of contributors will probably not be using SublimeText
63+
# *.sublime-project
64+
65+
# sftp configuration file
66+
sftp-config.json
67+
68+
# Ignore Sublime .phpintel
69+
.phpintel
70+
71+
# Ignore Visual Studio code
72+
.vscode
73+
74+
#
75+
# =================================
76+
# Gitignore For Composer & Projects
77+
# =================================
78+
79+
# ignore all log file
80+
*.log
81+
*.lock
82+
83+
# ignore npm lock
84+
package-lock.json
85+
pnpm-lock.yaml
86+
vendor/
87+
# ignore node modules
88+
node_modules/
89+
tmp/
90+
.tmp/
91+
*.map
92+
/index.php

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 ArrayIterator
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
# PHP Profiler
2+
3+
[![Code Checking](https://github.com/ArrayIterator/php.profiler/actions/workflows/code-checking.yml/badge.svg)](https://github.com/ArrayIterator/php.profiler/actions/workflows/code-checking.yml)
4+
5+
## INSTALLATION
6+
7+
```bash
8+
composer require arrayiterator/profiler
9+
```
10+
## PROFILING
11+
12+
```php
13+
use ArrayIterator\Profiler\Profiler;
14+
15+
$profiler = new Profiler();
16+
// start the profiler
17+
$performance = $profiler->start('benchmark', 'Group Name', ['data' => 'information']);
18+
try {
19+
// do something with the code
20+
// write the code that you want to benchmark
21+
} finally {
22+
// best practice to stop the profiler using try -> finally
23+
// using finally to make sure the profiler is stopped
24+
$performance->stop(['additional' => 'information']);
25+
// or using profiler object
26+
// the group name is important when you have different group of benchmark
27+
// the group: default, as default group
28+
// the name of benchmark also important to identify the benchmark
29+
$profiler->stop('benchmark', 'Group Name', ['additional' => 'information']);
30+
}
31+
32+
33+
```
34+
## RENDERING TOOLBAR
35+
36+
```php
37+
/**
38+
* @var \ArrayIterator\Profiler\Profiler $profiler
39+
*/
40+
$waterfall = $profiler->getWaterfall();
41+
42+
// render the toolbar
43+
$darkMode = null; // set true if default dark mode or let it null when using autodetect
44+
$content = $waterfall->renderJs($darkMode);
45+
46+
// can be echo or append to stream
47+
// echo $content;
48+
// append to stream interface (PSR-7)
49+
// $response->getBody()->write($content);
50+
```
51+
## PREVIEW
52+
53+
[![Toolbar Preview](images/preview-dark.png)](images/preview-dark.png)
54+
[![Toolbar Preview](images/preview-light.png)](images/preview-light.png)
55+
56+
## ATTENTION
57+
58+
This package still under development, the profiler is ready but the UI is not yet ready. The UI is still under development.
59+
60+
But the profiler is ready to use, you can use it by installing the package and use the profiler.
61+
You can customize the implementation of the Frontend or Backend.
62+
63+
## UI & IMPLEMENTATION OF RENDERER
64+
65+
Typescript & scss [**[assets](assets)**] is used to create the UI, the UI is created using the following technologies:
66+
67+
Maximum record size is 1000 records, if more than 1000 records, the UI will not render the benchmark.
68+
69+
### REQUIREMENT:
70+
71+
- PHP 7.4 or higher
72+
- Composer
73+
- DEV (Node.js (npm) - for installing the dependencies)
74+
75+
### TASKS
76+
77+
> BACKEND
78+
79+
- [x] Benchmark Profiler
80+
- [x] Memory Profiler
81+
- [x] Time Profiler
82+
- [x] Render Profiler
83+
- [x] Code Styling & PhpStan
84+
85+
> FRONTEND
86+
87+
- [x] ToolBar (Chrome Like)
88+
- [x] Dark Mode & Light Mode (Auto Detect)
89+
- [x] Resizeable
90+
- [x] Responsiveness
91+
- [x] Action Size
92+
- [x] Maximize
93+
- [x] Minimize (restore)
94+
- [x] Close
95+
- [x] Benchmark Tab
96+
- [x] Filtering
97+
- [x] Waterfall Profiling
98+
- [x] Importer
99+
- [x] Exporter
100+
- [x] Restorer
101+
- [x] Message (information about the import, export, restore)
102+
- [x] Input Search
103+
- [x] Horizontal Resizable Section
104+
- [ ] Labs Tab
105+
- [x] Source Tab
106+
107+
#### Benchmark Tab
108+
109+
- [x] Filtering
110+
- [x] Importer
111+
- [x] Exporter
112+
- [x] Restorer
113+
- [x] Message (information about the import, export, restore)
114+
- [x] General Filter
115+
- [x] Performance Filter (Slow, Fast, Average)
116+
- [x] Search Filter (Follow the benchmark content)
117+
- [x] Aggregator Filter (Follow the benchmark aggregation)
118+
- [x] Waterfall Profiling
119+
- [x] Using waterfall using div percentage
120+
- [ ] Add additional information for certain table
121+
- [ ] Clickable to show the detail of the benchmark
122+
123+
#### Labs Tab
124+
125+
- [ ] Profiler Information
126+
- [ ] Metadata of JSON
127+
- [ ] RAM Usage & Limit (chart using pie chart from highchart.js)
128+
- [ ] Additional Information
129+
- [ ] Chart for benchmark (multiple chart type)
130+
131+
#### Source Tab
132+
133+
- [x] Code Section
134+
- [x] Prettify/Minify the source code
135+
- [x] Download the source code
136+
- [x] Import the source code
137+
138+
139+
## DEPENDENCIES
140+
141+
- Template Engine using [SquirrellyJS](https://squirrelly.js.org/)
142+
- Chart using [HighChart](https://www.highcharts.com/)
143+
- Icon & SVG using [HeroIcons](https://heroicons.com/)
144+
- Compiled JS using [Webpack](https://webpack.js.org/) & [TypeScript](https://www.typescriptlang.org/)
145+
- Compiled CSS using [Sass](https://sass-lang.com/)
146+
147+
## LICENSE
148+
149+
[MIT License](LICENSE)

0 commit comments

Comments
 (0)