Skip to content

Commit 4756091

Browse files
author
Alcides Ramos
committed
docs(README): improved sections with tips and notes
1 parent 736037b commit 4756091

2 files changed

Lines changed: 51 additions & 35 deletions

File tree

README.md

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,21 @@ This repository contains an application skeleton following best practices.
1414

1515
### Highlights
1616

17-
- Unified environment to build CLI, web applications and/or microservices based on **PHP8**.
18-
- Includes **PCOV**, **PHPCS/PHPCBF**, **PHPUnit**, **UOPZ**, **PHPStan** and a **linter** by default.
17+
- Minimalist project
18+
- Includes frequently used tools such as a **Linter**, **PHPStan**, **PHPUnit**, **ClockMock**, **CodeSniffer** and **VarDumper**.
1919

2020

2121
## Requirements
2222

2323
To use this repository you need:
2424

25-
### Sofware
25+
### Software
2626

2727
- [Git](https://git-scm.com/) - The free and open source distributed version control system.
2828

29-
### Extensions
30-
31-
- [UOPZ](https://www.php.net/manual/en/book.uopz.php) - In order to allow mocking date/time functions
32-
- [PCOV](https://github.com/krakjoe/pcov) - In order to generate the PHP code coverage report
33-
34-
3529
## Built with
3630

37-
| Type | Component | Description |
38-
| ----------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
39-
| Service | [PHP-FPM](https://www.php.net/manual/en/install.fpm.php) | PHP with FastCGI Process Manager |
40-
| Miscelaneous | [Make](https://www.gnu.org/software/make/) | Allows to execute commands defined on a _Makefile_ |
41-
| Quality Assurance | [PHP-Parallel-Lint](https://github.com/php-parallel-lint/PHP-Parallel-Lint) | Allows to check the syntax of PHP files in parallel |
42-
| Quality Assurance | [PHPCS/PHPCBF](https://github.com/PHPCSStandards/PHP_CodeSniffer/) | Allows to check and fix coding style issues |
43-
| Quality Assurance | [PHPStan](https://phpstan.org/) | Allows to perform static analysis of your application looking for issues |
44-
| Quality Assurance | [PHPUnit](https://phpunit.de/) | The PHP Testing Framework |
31+
This project was built with [Dockerized PHP](https://github.com/fonil/dockerized-php), a lightweight dockerized environment to build PHP applications.
4532

4633

4734
## Getting Started
@@ -76,23 +63,23 @@ $ git clone git@github.com:fonil/php-skeleton.git .
7663
└── README.md # This document
7764
```
7865

79-
#### Custom commands
66+
#### Composer commands
8067

8168
Custom commands are added to `composer.json` under the `scripts` section.
8269

8370
##### Available commands
8471

85-
| Command | Description |
86-
|------------------|--------------------------------------------------------------------------|
87-
| `clear-coverage` | Removes any previous HTML code coverage report |
88-
| `tests` | Runs PHPUnit with the specs defined at `phpunit.xml` configuration file |
89-
| `coverage` | Generates the HTML code coverage report |
90-
| `phpcs` | Runs the PHP Check Style command following the PSR-12 |
91-
| `phpcbf` | Runs the PHP Code Beautifier and Fixer command following the PSR-12 |
92-
| `linter` | Runs the linter in parallel mode |
93-
| `phpstan` | Runs PHPStan with the specs defined at `phpstan.neon` configuration file |
72+
| Command | Description |
73+
| ---------- | ------------------------------------------------------------ |
74+
| `linter` | Runs the linter in parallel mode |
75+
| `phpcs` | Runs **PHP Check Style** command following the PSR-12 |
76+
| `phpcbf` | Runs **PHP Code Beautifier** and **Fixer** command following the PSR-12 |
77+
| `phpstan` | Runs **PHPStan** with the specs defined at `phpstan.neon` configuration file |
78+
| `phpunit` | Runs **PHPUnit** with the specs defined at `phpunit.xml` configuration file |
79+
| `tests` | Runs **PHPUnit** without code coverage support |
80+
| `coverage` | Runs **PHPUnit** with **PCOV** code coverage support |
9481

95-
##### Makefile
82+
#### Makefile
9683

9784
Additionally a *Makefile* is provided with frequently used commands:
9885

@@ -117,22 +104,49 @@ Additionally a *Makefile* is provided with frequently used commands:
117104
· phpstan QA: <composer phpstan>
118105
· tests QA: <composer tests>
119106
· coverage QA: <composer coverage>
120-
· clean-cache QA: <composer clean-cache>
121107
```
122108

123109

110+
> [!NOTE]
111+
>
124112
> This file is really useful when you create a container with a project based on this repository and you want to run those commands from outside the container, directly from your *host*. To do so just copy and paste the included steps on your main *Makefile* and adjust the constants accordingly.
125113
114+
##### Installing Dependencies
115+
116+
```bash
117+
$ make composer-install
118+
```
119+
120+
##### Running the Test Cases
121+
122+
###### Default command
123+
124+
```bash
125+
$ make tests
126+
```
127+
128+
###### Run only Unit testsuite
129+
130+
```bash
131+
$ make tests testsuite=Unit
132+
```
133+
134+
###### Filter a specific test
135+
136+
```bash
137+
$ make tests filter="checkInvokeMethod tests/Unit/Providers/FooTest.php"
138+
```
126139

127140
#### Volumes
128141

129142
##### Coverage report in HTML
130143

131144
Coverage report in HTML is generated on a root folder `/coverage`
132145

133-
146+
> [!TIP]
147+
>
134148
> If you want the report is generated on a different path, just update accordingly the `composer.json` file under the section `scripts`
135-
149+
136150

137151
## Security Vulnerabilities
138152

phpunit.xml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.1/phpunit.xsd"
44
bootstrap="vendor/autoload.php"
55
cacheDirectory="/tmp/.phpunit.cache"
66
executionOrder="depends,defects"
77
requireCoverageMetadata="true"
88
beStrictAboutCoverageMetadata="true"
99
beStrictAboutOutputDuringTests="true"
1010
failOnRisky="true"
11-
failOnWarning="true">
11+
failOnWarning="true"
12+
>
1213
<testsuites>
1314
<testsuite name="Unit">
1415
<directory suffix=".php">tests/Unit</directory>
1516
</testsuite>
1617
</testsuites>
1718

18-
<source restrictDeprecations="true" restrictNotices="true" restrictWarnings="true">
19+
<source restrictNotices="true" restrictWarnings="true" ignoreIndirectDeprecations="true">
1920
<include>
2021
<directory>app</directory>
2122
</include>
@@ -24,6 +25,7 @@
2425
<coverage includeUncoveredFiles="true"
2526
pathCoverage="false"
2627
ignoreDeprecatedCodeUnits="true"
27-
disableCodeCoverageIgnore="true">
28+
disableCodeCoverageIgnore="true"
29+
>
2830
</coverage>
2931
</phpunit>

0 commit comments

Comments
 (0)