alcidesrc / php-skeleton
Application skeleton for projects based on PHP
                                    Fund package maintenance!
                                                                            
                                                                                                                                        AlcidesRC
                                                                                    
                                                                            
                                                                                                                                        www.paypal.me/AlcidesRC
                                                                                    
                                                                
Installs: 53
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Language:Makefile
Type:project
pkg:composer/alcidesrc/php-skeleton
Requires
- php: ^8.4
Requires (Dev)
- brianium/paratest: ^7.8
- nunomaduro/mock-final-classes: ^1.2
- 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
- squizlabs/php_codesniffer: ^3.9
- symfony/var-dumper: ^7.0
README
PHP Skeleton
An application skeleton for modern PHP projects, PoC, side-projects...
[TOC]
Summary
This repository contains an application skeleton following best practices.
Highlights
- Minimalist project
- Includes frequently used tools such as a Linter, PHPStan, PHPUnit, CodeSniffer and VarDumper.
Requirements
To use this repository you need:
Software
- Git - The free and open source distributed version control system.
Built with
This project was built with Dockerized PHP, a lightweight dockerized environment to build PHP applications.
Getting Started
Just clone the repository into your preferred path:
$ mkdir -p ~/path/to/my-new-project && cd ~/path/to/my-new-project $ git clone git@github.com:alcidesrc/php-skeleton.git .
Conventions
Directory structure
.
├── app                 # Your application business logic goes here
├── composer.json       # Application dependencies main file
├── composer.lock       # Application dependencies locked file
├── LICENSE
├── Makefile
├── phpcs.xml           # PHPCS configuration file
├── phpstan.neon        # PHPStan configuration file
├── phpunit.xml         # PHPUnit configuration file
├── public              # Public folder
├── README.md
├── tests               # Tests folder
└── vendor
Composer commands
Custom commands are added to composer.json under the scripts section.
Available commands
| Command | Description | 
|---|---|
| linter | Runs the linter in parallel mode | 
| phpcs | Runs PHP Check Style command following the PSR-12 | 
| phpcbf | Runs PHP Code Beautifier and Fixer command following the PSR-12 | 
| phpstan | Runs PHPStan with the specs defined at phpstan.neonconfiguration file | 
| phpunit | Runs PHPUnit with the specs defined at phpunit.xmlconfiguration file | 
| tests | Runs PHPUnit without code coverage support | 
| coverage | Runs PHPUnit with PCOV code coverage support | 
Makefile
Additionally a Makefile is provided with frequently used commands:
~/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> inside the container · check-style QA: executes <check-style> inside the container · fix-style QA: executes <fix-style> inside the container · phpstan QA: executes <composer phpstan> inside the container · test QA: executes <composer paratest> inside the container · coverage QA: executes <composer paracoverage> inside the container
Installing Dependencies
$ make composer-install
Running the Test Cases
$ make test
Volumes
Coverage report in HTML
Coverage report in HTML is generated on a root folder /.coverage
Tip
If you want the report is generated on a different path, just update accordingly the composer.json file under the section scripts
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities:
PLEASE DON'T DISCLOSE SECURITY-RELATED ISSUES PUBLICLY
Supported Versions
Only the latest major version receives security fixes.
Reporting a Vulnerability
If you discover a security vulnerability within this project, please open an issue here. All security vulnerabilities will be promptly addressed.
License
The MIT License (MIT). Please see LICENSE file for more information.