parf / composer-php8-template
PHP8/8.1 Template for composer/packagist
Package info
github.com/parf/composer-php8-template
Type:project
pkg:composer/parf/composer-php8-template
Requires
- php: >=8.0
README
UNSUPPORTED / OLD TEMPLATE
This repository is no longer supported.
Please use the current template instead:
INSTALL / How to Use:
composer create-project parf/composer-php8-templateyour-project-name- edit
composer.json - run
composer install
Provides:
- ready to use Composer Package Template for php 8/8.1 projects
- commonly used php tools (see list below)
- default tools configurations
- useful scripts
Provided Php-Tools
- php code linter
- psalm static code analyzer and fixer
- php-stan static code analyzer
- rector code analyzer & refactoring tool
- phpDocumentor documentation application for PHP projects
- php-cs-fixer Coding Standards Fixer
- php-unit Unit Testing
- spartan-test (phpunit alternative) + automated web-test framework
- psysh - php cli shell
Shared tools setup
This template expects a tools symlink that points at the shared php-tools bin/ directory.
Example setup:
mkdir -p ~/src cd ~/src git clone https://github.com/homebase/php-tools.git cd php-tools ./php-tools install all cd /path/to/your-project ln -s ~/src/php-tools/bin tools
See setup-tools.howto for the full notes.
Scripts
composer test
run unit tests. usetest-qto run tests silently (show errors only)
composer psalm
check code with psalm
composer stan
check code with php-stan (default level is 6)
composer lint
php syntax check
composer psalm-dry/composer psalm-fix(aka psalter)
review/apply suggested code changes by psalm, be careful always do dry-run first
composer cs-dry/composer cs-fix
review/apply suggested code changes by php-cs-fixer, be careful always do dry-run first
composer doc
generate phpDocumentor documentation indocfolder
./check
do all checks: lint, unit tests, psalm, php-stan; stops when any of them failed
./check-commit,./check-push
do./check, add all new files to git, dogit commit -v -sandgit push --tags
./psyshphp cli shell
notable commands:wtf,doc Class,doc Class::method,show Class::method,ls -l ClassName,help
see composer.json scripts section for more scripts shortcuts