Measure PHP project complexity and maintainability

I’m optimizing my Meta Box plugin and I need a way to measure the project’s statistics such as complexity and maintainability. After searching on Google, I found PHPMetrics, a wonderful project that can help me understand lots of key metrics for a PHP project. The result is displayed in a HTML report with some graphs and table of metrics which are very easy to understand. I tried using it with the Meta Box plugin and here is the result:

Continue reading → Measure PHP project complexity and maintainability

PHP Quick Tip: Comment Block

PHP Quick Tip: Comment Block

PHP has 2 types of comments: comment block (for long comments in many continuous lines) and short comment (for one line). When test code, if we don’t want to a block of code execute, we can disable it by turning them into comment blocks using /* ... */, and when we want to execute it, just remove /* and */ characters at the beginning and the end of code. This action is often repeated, and in this article, I want to share a small tip to make this process faster and easier.

Continue reading → PHP Quick Tip: Comment Block

Create A Multiple URL Shortener Page

Create A Multiple URL Shortener Page

There are various url shortener services on the Internet, you can use free services such as bit.ly, tinyURL or create your own url shortener using some open sources. In this article, I’ll show you how to create a simple page that shows short urls created by multiple url shortener services. I’ll use HTML5, CSS3 for styling as well as jQuery for working with Ajax.

Continue reading → Create A Multiple URL Shortener Page

URL Shortener: Principles, Sample Code And Sources

URL Shortener: Principles, Example Code And Sources

URL Shortener makes a short version of a long given URL. There are many URL shorteners out there like bit.ly, tinyurl or is.gd. Of course we can use their API to create short urls, but it’s not interesting for developers, who want to look into the very deep of the mechanism.

Short url often has structure: , where hash is a string (unique) for a long url. Hash contains only digits and letters. In some cases letters are case sensitive.

Continue reading → URL Shortener: Principles, Sample Code And Sources