Posts tagged ‘PHP’

Simplified version of my PHP test runner

In my course of getting continuous testing in practice I have improved my test runner by using less dependencies.

Previously I have implemented this by using Ruby and its Watchr gem, but now this script only relies on inotifywait binary available in major distributions.

As usual this script helps you to track your code for changes and if changed it will automatically run a bunch of actions.

Pingback-php: a library for performing Pingback calls in an easy-way

Today I’m pleased to announce another library that I made. Pingback-php is a library for performing Pingback requests in a simple way. Pingback-PHP is compliant with the Pingback 1.0 standard specification.

A quick example:

If you want to inform to this article that you have referenced it from one of your posts by using the Pingback protocol, you can do it with this code:

// Prepare the Pingback client
$requestHandler = new Pingback\RequestHandler();
$client = new Pingback\Client($requestHandler);

// Perform the pingback call
try {

    $client->ping(
        "http://www.mabishu.com/blog/2012/12/14/get-better-performance-and-life-from-your-ssd-in-linux-based-systems/",
        "http://www.mabishu.com/blog/2012/12/14/object-calisthenics-write-better-object-oriented-code/";
    );

} catch (Pingback\Exception $e) {
  printf("Exception raised with code (%d) : %s\n", $e->getCode(), $e->getMessage());
}

Test your code with every change in your PHP files

Applying TDD to your PHP code is a big improve in your code as forces you to “think” the code before write it down. A common approach to TDD workflow could be:

  1. Write your test class
  2. Write your code that make pass the tests
  3. Refactor the code

If you take a closer look, between all the steps you MUST run all the tests for possible functionality breaks with every single change in the code, and make it manually could be a little disturbing.

So for this there are  tools that helps you track your code for changes and if changed will automatically run a bunch of actions.

How to easily create Debian packages for PHP extensions

Debian PHP packages

Let me explain to all of you how to create a Debian package from a PECL tarball. Currently is very simple to package a PECL extension without having any previous experience in Debian packaging and thus this system administration by installing deb packages could be more easy too.

So let’s start the packaging.

Page 1 of 3