phpcs

PHP_CodeSniffer is a PHP5 script that tokenises and sniffs PHP, JavaScript and CSS files to detect violations of a defined coding standard. It is an essential development tool that ensures your code remains clean and consistent. It can also help prevent some common semantic errors made by developers.

Eclipse PHP Tool Integration

I have activated phpcs on my Jenkins Continuous Integration Build to be able to check my Code Styling, having Jenkins running on a AWS EC2 micro-machine, the build was taking forever, this wasn't a solution, so I look for alternative and found Eclipse PHP Tool Integration!

In fact, why activating phpcs on Jenkins if we can have direct feedback from the IDE ?

You can find the Installation procedure here and configuration and usage here.

PART 5: PHP Software Development Environment - Eclipse PDT and Dev Tools set up

In this part we'll set up our Eclipse Development environment, we'll use our Debian 6.0 Squeeze with an X Windows Manager Virtual Machine for this.

Installing JVM

Before Installing Eclipse we need to have JVM installed, you can install Sun Java or OpenSDK but NOT the GCJ (GNU Java tools), here I have used Sun Java, in your terminal type:

$ sudo apt-get update
$ sudo apt-get install sun-java6-bin sun-java6-javadb sun-java6-jdk sun-java6-plugin

Make Sun Java the Java runtime of your choice:

$ sudo update-java-alternatives -s java-6-sun

Check, if Java is properly installed:

$ java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)

Then we need to set the Java environment variable $JAVA_HOME

Edit the file/etc/profile and at the end add:

JAVA_HOME="/usr/lib/jvm/java-6-sun"
export JAVA_HOME

Note that you may need to log off and login again to ensure Java is properly recognized by your system.

PART 3: PHP Software Development Environment - CI-Build Server - Setting up Jenkins

Installing the Jenkins Debian packages

This is the Debian package repository of Jenkins to automate installation and upgrade. To use this repository, first add the key to your system:

$ wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -

Then add the following entry in your /etc/apt/sources.list:

$ deb http://pkg.jenkins-ci.org/debian binary/

Update your local package index, then finally install Jenkins:

$ sudo apt-get update
$ sudo apt-get install jenkins

You should now be able to access jenkins at the URL: http://ci-build.yourdomain.com:8080/

Installing the PHP Tools packages to be used with Jenkins:

Let's install PHPUnit, Behat, Mink, pdepend, phpmd, phpcs.

PART 1: PHP Software Development Environment - Setting up Virtual Machines

This is the first post of a Tutorial to set up a PHP Software development environment including the Project Management, Continuous Integration, Software Quality metrics, Software Testing and Debugging Tools. This post is about the set up of the Virtual machines, I will post the following Tutorial parts in the coming days, the first few parts will be about the environment setting up then after we will see the usage of the tools we have installed.

I have used Virtualbox and OpenVZ virtualization for setting up this Environment on a Ubuntu Hosts.

So let's type in our console:

$ apt-get install virtualbox

Virtualbox installed, now let's create 5 virtual machines:

Syndicate content