PHP Project Starter is a command line tool that allows developers to quickly create PHP applications that use common conventions and best-in-breed development tools. The goals of this application are to guide developers towards best practices and get them from zero-to-CI in seconds.
The applications created by this tool have an opinionated directory structure, build system, and pre-configured set of services connections. Refer to the Tools And Conventions and Directory Structure sections below for more details.
curl -sLO https://github.com/cpliakas/php-project-starter/releases/download/0.2.8/php-project.phar
Run php php-project.phar --help
to see all options supported by the command
line tool and ensure that installation succeeded.
It is also common practice to place the php-project.phar
file in a location
that makes it easier to access, for example /usr/local/bin
, and renaming it
to php-project
. Ensure the file is executable by running chmod 755
so that
you don't have to prefix the command with php
.
php php-project.phar \
--label="My Project" \
--description="A longer description for My Project" \
--namespace="My\Project" \
cpliakas/my-project
Pass the --jenkins-url
option to post a job to Jenkins that consumes the
build artifacts.
Make a new repository
matching the project name (e.g. cpliakas/my-project
) and push your code. Note
that the origin
remote is already set in the repository.
cd ../path/to/working-copy
git push -u origin master
- Packagist: Follow the Publish It section
- Travis CI: Follow steps one and two of the Getting Started documentation
- Coveralls: Follow the Getting Started documentation
Running ant
in the newly created project's root directory will download
Composer, install development dependencies, run PHPUnit, and generate a code
coverage report and software metrics in the ./build
directory.
The main targets can be found by running ant -p
and are listed below:
clean
: Cleanup build artifactsclean-src
: Cleanup dependency source codeclean-all
: Cleanup build artifacts and dependency source codecomposer
: Run composer updatelint
: Perform syntax check of sourcecode filespdepend
: Calculate software metrics using PHP_Dependphpcpd
: Find duplicate code using PHPCPDphploc
: Measure project size using PHPLOCphpmd
: Perform mess detection using PHPMD, print human readable output.phpmd-ci
: Perform mess detection using PHPMD, creating a log file for the CI serverphpunit
: Run unit tests with PHPUnit
Common command line options that set Ant properties are listed below:
-Dcomposer.noselfupdate=1
: Do not runcomposer self-update
during the build-Dcomposer.noupdate=1
: Do not runcomposer update
during the build
Tools and conventions that this template expects the PHP project being started to embrace.
- Template for Jenkins Jobs for PHP Projects
- PHP Standards Recommendations (PSR)
- The MIT License (MIT)
- EditorConfig
.
|-- src/
|-- test/
|-- .coveralls.yml
|-- .editorconfig
|-- .gitignore
|-- .travis.yml
|-- build.xml
|-- composer.json
|-- phpmd.xml
|-- phpunit.xml
|-- LICENSE
`-- README.md
.
`-- build/
|-- coverage/
| `--index.html
|-- logs/
| |-- clover.xml
| |-- jdepend.xml
| |-- junit.xml
| |-- phploc.csv
| |-- pmd-cpd.xml
| `-- pmd.xml
|-- pdepend/
| |-- dependencies.svg
| `-- overview-pyramid.svg
`-- composer.phar