Skip to content

Commit 0bccf9e

Browse files
authored
Merge pull request #18 from imanghafoori1/1.x
"Check imports" workflow for Github actions
2 parents c534cf4 + 85a3f73 commit 0bccf9e

File tree

2 files changed

+55
-21
lines changed

2 files changed

+55
-21
lines changed

.github/workflows/check_imports.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Check Imports
2+
3+
on:
4+
push:
5+
branches: [ "1.x" ]
6+
pull_request:
7+
branches: [ "1.x" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
check_imports:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Cache Composer packages
21+
id: composer-cache
22+
uses: actions/cache@v4
23+
with:
24+
path: vendor
25+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
26+
restore-keys: |
27+
${{ runner.os }}-php-
28+
29+
- name: Install dependencies
30+
run: composer install --prefer-dist --no-progress && composer require imanghafoori/php-imports-analyzer --dev
31+
32+
- name: Check Imports
33+
run: ./vendor/bin/check_imports

readme.md

+22-21
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<a href="https://packagist.org/packages/laracraft-tech/laravel-xhprof"><img src="https://img.shields.io/packagist/dt/laracraft-tech/laravel-xhprof" alt="Total Downloads"></a>
55
<a href="https://packagist.org/packages/laracraft-tech/laravel-xhprof"><img src="https://img.shields.io/packagist/v/laracraft-tech/laravel-xhprof" alt="Latest Stable Version"></a>
66
<a href="https://packagist.org/packages/laracraft-tech/laravel-xhprof"><img src="https://img.shields.io/packagist/l/laracraft-tech/laravel-xhprof" alt="License"></a>
7+
<a href="https://github.com/laracraft-tech/laravel-xhprof/actions/workflows/check_imports.yml"><img src="https://github.com/laracraft-tech/laravel-xhprof/actions/workflows/check_imports.yml/badge.svg?branch=1.x" alt="License"></a>
78
</p>
89

910
<!--
@@ -16,9 +17,9 @@
1617

1718
## Introduction
1819

19-
Laravel XHProf provides you with a simple setup to profile your laravel application
20-
with the well known XHProf PHP extension originally developed by facebook.
21-
It also leads you through the steps to install XHProf UI, a UI to visualize, save and analyze the results
20+
Laravel XHProf provides you with a simple setup to profile your Laravel application
21+
with the well-known XHProf PHP extension originally developed by Facebook.
22+
It also leads you through the steps to install XHProf UI, a UI to visualize, save, and analyze the results
2223
of the profiling.
2324

2425
<p align="center">
@@ -27,8 +28,8 @@ of the profiling.
2728

2829
## Installation
2930

30-
First you'll need to install the PHP extension.
31-
It's highly recommended using ondrejs ppa.
31+
First, you'll need to install the PHP extension.
32+
It's highly recommended to use ondrejs ppa.
3233
It's well maintained and provides quite all PHP versions.
3334

3435
### Normal environment
@@ -38,13 +39,13 @@ If you have a normal PHP environment, just install the XHProf extension:
3839
``` bash
3940
sudo add-apt-repository ppa:ondrej/php
4041
sudo apt-get update
41-
sudo apt-get install php php-xhprof graphviz
42-
# you can now check if the extension was successfully installed
42+
sudo apt-get install php php-xhprof Graphviz
43+
# You can now check if the extension was successfully installed
4344
php -i | grep xhprof
4445
# maybe restart your webserver or php-fpm...
4546
```
4647

47-
Note: we need graphviz to generate callgraphs.
48+
Note: we need Graphviz to generate callgraphs.
4849

4950
### Laravel Sail environment
5051

@@ -54,12 +55,12 @@ If you are using laravel sail, here's a setup for you:
5455
sail up -d
5556
sail artisan sail:publish
5657
# in docker-compose.yml check wich php version is used under build->context (eg. ./docker/8.1)
57-
# if you know the php-version you can type:
58+
# If you know the php-version you can type:
5859
nano docker/<php-version>/Dockerfile
59-
# find the block where all php extionsions are installed and add "php<php-version>-xhprof graphviz \"
60-
# now you need to rebuild sail
60+
# find the block where all php extensions are installed and add "php<php-version>-xhprof graphviz \"
61+
# Now you need to rebuild the sail
6162
sail down ; sail build --no-cache ; sail up -d # this may take a while...
62-
# you can now check if the extension was successfully installed
63+
# You can now check if the extension was successfully installed
6364
sail php -i | grep xhprof
6465
```
6566

@@ -79,7 +80,7 @@ https://www.php.net/manual/en/xhprof.requirements.php
7980

8081
``` bash
8182
mkdir public/vendor ; git clone git@github.com:preinheimer/xhprof.git ./public/vendor/xhprof
82-
# if you havent already, I recommend adding public/vendor to your .gitignore
83+
# If you haven't already, I recommend adding public/vendor to your .gitignore
8384
echo "/public/vendor" >> .gitignore
8485
```
8586

@@ -88,11 +89,11 @@ echo "/public/vendor" >> .gitignore
8889
Since the database table name,
8990
which the UI package is using behind to store and read data from the database,
9091
is hard coded to ``details`` and you already may have a table named like that,
91-
you may need to make some additional steps. If not, here at first the simple way:
92+
you may need to take some additional steps. If not, here at first the simple way:
9293

9394
<br/>
9495

95-
#### In case you DON'T already HAVE an own ``details`` table in your database:
96+
#### In case you DON'T already HAVE your own ``details`` table in your database:
9697

9798
``` bash
9899
php artisan vendor:publish --provider="LaracraftTech\LaravelXhprof\XHProfServiceProvider" --tag="migrations"
@@ -102,7 +103,7 @@ php artisan migrate
102103

103104
#### In case you already HAVE an own ``details`` table in your database:
104105

105-
I recommend to just use a different database.
106+
I recommend just using a different database.
106107

107108
``` mysql
108109
CREATE DATABASE xhprof;
@@ -134,17 +135,17 @@ CREATE TABLE IF NOT EXISTS `details` (
134135
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
135136
```
136137

137-
Note: you also need to create a user which has privileges on that new database!
138+
Note: you also need to create a user who has privileges on that new database!
138139

139140
### Config
140141

141142
Now let's configure some settings!
142143

143144
``` bash
144145
cp public/vendor/xhprof/xhprof_lib/config.sample.php public/vendor/xhprof/xhprof_lib/config.php
145-
# 1. change the db credentials to your needs
146+
# 1. Change the DB credentials to your needs
146147
# 2. enable dot_binary section
147-
# 3. if you're local, set $controlIPs to false
148+
# 3. If you're local, set $controlIPs to false
148149
nano public/vendor/xhprof/xhprof_lib/config.php
149150
```
150151

@@ -154,7 +155,7 @@ Just set ``XHPROF_ENABLED=true`` in your .env file and
154155
now every request you make to your application gets profiled. \
155156
Visit ``<your-host>/vendor/xhprof/xhprof_html/`` to see your profiling results.
156157

157-
Happy analysing!
158+
Happy analyzing!
158159

159160

160161
<!--
@@ -173,7 +174,7 @@ composer test
173174

174175
## Security
175176

176-
If you discover any security related issues, please email zacharias.creutznacher@gmail.com instead of using the issue tracker.
177+
If you discover any security-related issues, please email zacharias.creutznacher@gmail.com instead of using the issue tracker.
177178

178179
## Credits
179180

0 commit comments

Comments
 (0)