Git Product home page Git Product logo

php-project-starter's Introduction

PHP Project Starter

Build Status Code Coverage HHVM Status Scrutinizer Code Quality Latest Stable Version License

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 service connections with badges ready to go. Refer to the Tools And Conventions and Directory Structure sections below for more details.

See the examples below for repositories created by the PHP Project Starter tool:

Usage

Install The Command Line Tool

Download Via Browser

Download php-project.phar from https://github.com/cpliakas/php-project-starter/releases/latest,

Download Via Command Line

curl -O http://www.chrispliakas.com/php-project-starter/download/latest/php-project.phar

Test It Out!

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.

Create A New Project

php php-project.phar new \
  --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 Repository On GitHub

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

Configure Other Services

Keeping Up-To-Date

Run the following command to update PHP Project Starter to the latest stable version:

php php-project.phar self-update

Using Apache Ant

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 artifacts
  • clean-src: Cleanup dependency source code
  • clean-all: Cleanup build artifacts and dependency source code
  • composer: Run composer update
  • lint: Perform syntax check of sourcecode files
  • pdepend: Calculate software metrics using PHP_Depend
  • phpcpd: Find duplicate code using PHPCPD
  • phploc: Measure project size using PHPLOC
  • phpmd: Perform mess detection using PHPMD, print human readable output.
  • phpmd-ci: Perform mess detection using PHPMD, creating a log file for the CI server
  • phpunit: Run unit tests with PHPUnit

Common command line options that set Ant properties are listed below:

  • -Dcomposer.noselfupdate=1: Do not run composer self-update during the build
  • -Dcomposer.noupdate=1: Do not run composer update during the build

Tools And Conventions

Tools and conventions that this template expects the PHP project being started to embrace.

Dependency Management

Build & CI

Code Quality

Services

Conventions

Directory Structure

PHP Project

.
|-- src/
|-- test/
|-- .editorconfig
|-- .gitignore
|-- .scrutinizer.yml
|-- .travis.yml
|-- build.xml
|-- composer.json
|-- phpmd.xml
|-- phpunit.xml
|-- LICENSE
`-- README.md

Build Artifacts

.
`-- 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

php-project-starter's People

Contributors

cpliakas avatar

Watchers

James Cloos avatar Rajnish Kumar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.