alcidesrc / php-skeleton
基于PHP的项目应用骨架
1.0.5
2024-09-08 19:31 UTC
Requires
- php: ^8.3
Requires (Dev)
- php-parallel-lint/php-console-highlighter: ^1.0
- php-parallel-lint/php-parallel-lint: ^1.3
- phpmd/phpmd: ^2.15
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^11.0
- slope-it/clock-mock: ^0.4.0
- squizlabs/php_codesniffer: ^3.9
- symfony/var-dumper: ^7.0
README
PHP 骨架
现代PHP项目的应用骨架。
[目录]
摘要
此存储库包含遵循最佳实践的应用骨架。
亮点
- 极简项目
- 包括常用工具,如 Linter、PHPStan、PHPUnit、ClockMock、CodeSniffer 和 VarDumper。
需求
要使用此存储库,您需要
软件
- Git - 免费和开源的分布式版本控制系统。
构建方式
本项目使用 Dockerized PHP 构建,这是一个轻量级的Docker环境,用于构建PHP应用程序。
入门指南
只需将存储库克隆到您首选的路径
$ mkdir -p ~/path/to/my-new-project && cd ~/path/to/my-new-project $ git clone git@github.com:alcidesrc/php-skeleton.git .
约定
目录结构
.
├── app # Application business logic goes here
├── public # Public folder
│ └── index.php # Application entry point
├── tests # Tests folder
│ └── Unit # Unit Tests folder
├── vendor # Dependencies folder
├── .gitignore # Git ignore file
├── composer.json # Composer dependencies files
├── composer.lock # Composer lock file
├── LICENSE # License document
├── Makefile # Makefile with frequent commands
├── phpcs.xml # PHPCS configuration file
├── phpstan.neon # PHPStan configuration file
├── phpunit.xml # PHPUnit configuration file
└── README.md # This document
Composer命令
自定义命令添加到 composer.json
中的 scripts
部分。
可用命令
Makefile
另外,提供了一个包含常用命令的 Makefile。
~/path/to/my-new-project$ make ╔══════════════════════════════════════════════════════════════════════════════╗ ║ ║ ║ .: AVAILABLE COMMANDS :. ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ · composer-dump [COMPOSER] Executes <composer dump-auto> inside the container · composer-install [COMPOSER] Executes <composer install> inside the container · composer-remove [COMPOSER] Executes <composer remove> inside the container · composer-require-dev [COMPOSER] Executes <composer require --dev> inside the container · composer-require [COMPOSER] Executes <composer require> inside the container · composer-update [COMPOSER] Executes <composer update> inside the container · check-syntax [QA] Executes <check-syntax [filter=app]> inside the container · check-style [QA] Executes <check-style [filter=app]> inside the container · fix-style [QA] Executes <fix-style [filter=app]> inside the container · phpstan [QA] Executes <phpstan [filter=app]> inside the container · tests [QA] Executes <phpunit --testsuite=[testsuite=Unit] --filter=[filter=.]> inside the container · coverage [QA] Executes <phpunit --coverage-html=[folder=./coverage]> inside the container
安装依赖
$ make composer-install
运行测试用例
默认命令
$ make tests [filter="checkInvokeMethod tests/Unit/Providers/FooTest.php"]
仅运行单元测试套件
$ make tests-unit [filter="checkInvokeMethod tests/Unit/Providers/FooTest.php"]
卷
HTML格式的覆盖率报告
HTML格式的覆盖率报告生成在根目录 /coverage
下。
提示
如果您希望报告在另一个路径生成,只需相应地更新 composer.json
文件中的 scripts
部分。
安全漏洞
请查阅我们的安全策略,了解如何报告安全漏洞。
请勿公开披露与安全相关的问题
支持版本
只有最新的主要版本会收到安全修复。
报告漏洞
如果您在此项目中发现安全漏洞,请在此处创建一个问题。所有安全漏洞都将得到及时解决。
许可证
MIT许可证(MIT)。有关更多信息,请参阅LICENSE文件。