Skip to content

koriym/Koriym.PhpSkeleton

Repository files navigation

A standard PHP project skeleton

Are you tired of copy-pasting your boilerplate PHP code whenever you need to start a new project?

This repository contains a single-line command that will automatically setup for you all the needed code to create a modern, clutter-free and test-oriented PHP package.

It will automatically install the following dependencies:

  • PHPUnit: provides testing framework.
  • PHP_CodeSniffer: detects violations of a defined set of coding standards.
  • PHPMD: analyze your code to detect sub-optimal or overly complex code.
  • PHPStan: discover bugs in your code without running it.
  • Psalm: - another static analysis tool from Vimeo.
  • PHPMetrics provides various metrics.

As well as config file for popular continuous integration tool.

Create Project

To create your project, enter the following command in your console.

composer create-project koriym/php-skeleton <project-path>

You will be asked a few questions to configure the project:

What is the vendor name ?

(MyVendor):Koriym

What is the package name ?

(MyPackage):AwesomePackage

What is your name ?

(Akihito Koriyama):

What is your email address ?

(akihito.koriyama@gmail.com):

Composer Commands

Once installed, the project will automatically be configured, so you can run those commands in the root of your application:

test

composer test run phpunit.

tests

composer tests run cs, sa, and test.

coverage, phpdbg, pcov

composer coverage builds test coverage report. coverage use XDebug, phpdbg use phpdbg. pcov use pcov.

cs, cs-fix

composer cs checks coding standard. composer cs-fix fix up the PHP code.

sa

composer sa run static code analysis tools. (phpstan and psalm)

metrics

composer metrics reports code metrics.

build

composer build builds all reports.