<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PHP Developer Mirza Ahtasham Ahmad</title>
	<atom:link href="http://php-webdevelopment-services.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://php-webdevelopment-services.com</link>
	<description>6+ Years work experience of Web Development in LAMP/WAMP Architecture</description>
	<lastBuildDate>Wed, 22 Feb 2012 12:42:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Introduction to PhpDoc</title>
		<link>http://php-webdevelopment-services.com/introduction-to-phpdoc/</link>
		<comments>http://php-webdevelopment-services.com/introduction-to-phpdoc/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 14:24:37 +0000</pubDate>
		<dc:creator>Web Developer - Mirza Ahtasham Ahmad</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://php-webdevelopment-services.com/?p=241</guid>
		<description><![CDATA[<p>If you’ve ever tried to read code written by someone other than yourself (who hasn’t?), you know it can be a daunting task. A jumble of “spaghetti code” mixed with numerous oddly named variables makes your head spin. Does this function expect a string or an array? Does this variable store an integer or an [...]]]></description>
			<content:encoded><![CDATA[<p>If you’ve ever tried to read code written by someone other than yourself (who hasn’t?), you know it can be a daunting task. A jumble of “spaghetti code” mixed with numerous oddly named variables makes your head spin. Does this function expect a string or an array? Does this variable store an integer or an object? After countless hours of following the threads of code and trying to understand what each bit does, it’s not uncommon to give up and just rewrite the whole thing from scratch – a task that wastes far too much of your precious time.</p>
<p>PhpDoc, short for PhpDocumentor, is a powerful tool that allows you to easily document your code via specially formatted comments. The documentation will be available not only in the source code, but also in professional documentation extracted using either the web or command-line interface. The result can be in various formats such as HTML, PDF, and CHM. Additionally, many IDEs that provide code-completion can parse PhpDoc comments and provide useful features such as type-hinting. By using PhpDoc, you can make it easy for others (and yourself) to understand your code – weeks, months, and even years after you’ve written it.</p>
<p>The easiest way to install PhpDoc is with PEAR. Of course, before you can do so you must have PEAR installed. If you don’t, follow the instructions at <a href="http://pear.php.net/manual/en/installation.php">pear.php.net/manual/en/installation.php</a>.</p>
<p>In this article I’ll show you how to use PhpDoc to generate gorgeous and user-friendly documentation from beginning to end.</p>
<h2>DocBlocks</h2>
<p>A DocBlock is a multi-line C-style comment used to document a block of code. It begins with <code>/**</code>and has an asterisk at the start of each line. Here’s an example:</p>
<div id="highlighter_421372">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>&lt;?php</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>/**</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code> </code><code>* Calculates sum of squares of an array</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code> </code><code>*</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code> </code><code>* Loops over each element in the array, squares it, and adds it to</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code> </code><code>* total. Returns total.</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code> </code><code>*</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code> </code><code>* This function can also be implemented using array_reduce();</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code> </code><code>*</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code> </code><code>* @param array $arr</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code> </code><code>* @return int</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code> </code><code>* @throws Exception If element in array is not an integer</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code> </code><code>*/</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>function</code> <code>sumOfSquares(</code><code>$arr</code><code>) {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>    </code><code>$total</code> <code>= 0;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>    </code><code>foreach</code> <code>(</code><code>$arr</code> <code>as</code> <code>$val</code><code>) {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>17</code></td>
<td><code>        </code><code>if</code> <code>(!</code><code>is_int</code><code>(</code><code>$val</code><code>)) {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>18</code></td>
<td><code>            </code><code>throw</code> <code>new</code> <code>Exception(</code><code>"Element is not an integer!"</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>19</code></td>
<td><code>        </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>20</code></td>
<td><code>        </code><code>$total</code> <code>+= </code><code>$val</code> <code>* </code><code>$val</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>21</code></td>
<td><code>    </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>22</code></td>
<td><code>    </code><code>return</code> <code>$total</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>23</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>DocBlocks consist of three sections: short description, long description, and tags. All three sections are optional.</p>
<p>The short description is a succinct description terminated by either a new-line or a period. PhpDoc’s parsing routines are smart; it will only end the short description if the period is at the end of a sentence.</p>
<p>The long description is where the bulk of the documentation goes; it can be multi-line and as long you wish.</p>
<p>Both the long and short descriptions may contain certain HTML elements for formatting. HTML tags that aren’t supported will be displayed as plain text. PhpDoc can generate the documentation in multiple formats, though, so the HTML tags aren’t necessarily rendered as they would in an HTML file; the actual formatting depends on the generated file format. If you need to display an HTML tag as text, use double brackets. For example:</p>
<div id="highlighter_534812">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>&lt;?php</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>/**</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code> </code><code>* Here an example of the italics tag: &lt;&lt;i&gt;&gt;Hello, world!&lt;&lt;i&gt;&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code> </code><code>*/</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The tags section of a DocBlock contains any number of special tags denoted by the <code>@</code> symbol. The tags are used to specify additional information, such as the expected parameters and their type. Most tags must be on their own line, with the exception of certain tags which may be inline. Inline tags are surrounded with curly braces and may be in both the long and short description. For a full list of tags, check out the <a href="http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_tags.pkg.html">relevant PhpDoc documentation</a>.</p>
<p>If you need to start a line with the <code>@</code> symbol but you don’t want it to be interpreted as a tag, you can escape it with a backslash.</p>
<p>PhpDoc will automatically recognize textual lists in the long and short descriptions and it will parse them. However, it won’t parse nested lists correctly. If you want to use nested lists, use the HTML tags. Here is an example to illustrate what I mean:</p>
<div id="highlighter_557106">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>&lt;?php</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>/**</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code> </code><code>* Example of using lists</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code> </code><code>*</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code> </code><code>* PhpDoc will parse this list correctly:</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code> </code><code>* - Item #1</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code> </code><code>* - Item #2</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code> </code><code>* - Item #3</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code> </code><code>*</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code> </code><code>* But not this list:</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code> </code><code>* - Item 1</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code> </code><code>*   - Item 1.1</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code> </code><code>*   - Item 1.2</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code> </code><code>* - Item 2</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code> </code><code>*</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code> </code><code>* Use this instead for a nested list:</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>17</code></td>
<td><code> </code><code>* &lt;ul&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>18</code></td>
<td><code> </code><code>*   &lt;li&gt;Item 1&lt;/li&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>19</code></td>
<td><code> </code><code>*   &lt;ul&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>20</code></td>
<td><code> </code><code>*     &lt;li&gt;Item 1.1&lt;/li&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>21</code></td>
<td><code> </code><code>*     &lt;li&gt;Item 1.2&lt;/li&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>22</code></td>
<td><code> </code><code>*   &lt;/ul&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>23</code></td>
<td><code> </code><code>*   &lt;li&gt;Item 2&lt;/li&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>24</code></td>
<td><code> </code><code>* &lt;/ul&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>25</code></td>
<td><code> </code><code>*/</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<h2>Packages</h2>
<p>PhpDoc packages are used to group related code elements in the generated documentation. You can specify packages for files and classes and the documented code they contain will inherit the package from them. To specify a package, set the <code>@package</code> tag in a file-level or class-level DocBlock (file-level and class-level DocBlocks will be discussed further is the following section). A package name may contain letters, numbers, dashes, underscores, and square brackets (“[" and "]“).</p>
<p>Here is an example of defining a file’s package:</p>
<div id="highlighter_462411">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>&lt;?php</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>/**</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code> </code><code>* This is a file-level DocBlock</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code> </code><code>*</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code> </code><code>* @package Some_Package</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>6</code></td>
<td><code> </code><code>*/</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>If you have multiple levels of packages and sub-packages, you can define a sub-package with the<code>@subpackage</code> tag. Here is an example:</p>
<div id="highlighter_756020">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>&lt;?php</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>/**</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code> </code><code>* This is a class-level DocBlock</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code> </code><code>*</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code> </code><code>* @package    Some_Package</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>6</code></td>
<td><code> </code><code>* @subpackage Other</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>7</code></td>
<td><code> </code><code>*/</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>8</code></td>
<td><code>class</code> <code>SomeClass {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>9</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>If a file or class doesn’t specify a package it will be set to the default package, “default”. You can specify a different package to be used by default when generating the documentation via the <code>-dn</code>command-line option.</p>
<h2>What Can I Document?</h2>
<p>Not all code elements can be documented with DocBlocks. Here is a list of code elements that may be documented:</p>
<ul>
<li>Files</li>
<li>Classes</li>
<li>Functions and methods</li>
<li>Class properties</li>
<li>Global variables</li>
<li><code>include()</code>/<code>require()</code></li>
<li><code>define()</code></li>
</ul>
<p>All of these elements can use certain common tags, but each has tags that are specific to that element. I’ll go over a few of the elements and the tags normally used to document them.</p>
<h3>Files</h3>
<p>File-level DocBlocks are used to document the contents of a file. It is highly recommended to include a file-level DocBlock in every file you document, and in fact PhpDoc will display a warning if one is not found when generating documentation.</p>
<p>Most elements are documented by placing a DocBlock before the element, but files are an exception (since you can’t write anything before a file). File-level DocBlocks are placed on the first line of the file.</p>
<p>A file-level DocBlock usually contains the tags <code>@package</code>, <code>@subpackage</code>, <code>@license</code>, and<code>@author</code>. The <code>@package</code> and <code>@subpackage</code> tags were discussed earlier. The <code>@license</code> tag is used to specify a URL to an external license that covers your code. The tag must contain the URL to the license and optionally a title. The <code>@author</code> tag is used to specify the author of the file. It must contain the author’s name and optionally an email address in angle brackets.</p>
<p>Unlike most elements, a file-level DocBlock must contain a <code>@package</code> tag in order to be parsed properly.</p>
<p>Here is a complete example of a file-level DocBlock:</p>
<div id="highlighter_497588">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>&lt;?php</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>/**</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code> </code><code>* This file contains common functions used throughout the application.</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code> </code><code>*</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code> </code><code>* @package    MyProject</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>6</code></td>
<td><code> </code><code>* @subpackage Common</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>7</code></td>
<td><code> </code><code>* @license    <a href="http://opensource.org/licenses/gpl-license.php%C2%A0">http://opensource.org/licenses/gpl-license.php </a> GNU Public License</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>8</code></td>
<td><code> </code><code>* @author     Moshe Teutsch &lt;moteutsch@gmail.com&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>9</code></td>
<td><code> </code><code>*/</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<h3>Classes</h3>
<p>A class-level DocBlock is placed before a class definition and should describe the meaning of the class. Like file-level DocBlocks, class-level DocBlocks usually contain the tags <code>@package</code>,<code>@subpackage</code>, and <code>@author</code>. Here is an example:</p>
<div id="highlighter_988387">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>&lt;?php</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>/**</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code> </code><code>* An example class</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code> </code><code>*</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code> </code><code>* The class is empty for the sake of this example.</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code> </code><code>*</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code> </code><code>* @package    MyProject</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code> </code><code>* @subpackage Common</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code> </code><code>* @author     Moshe Teutsch &lt;moteutsch@gmail.com&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code> </code><code>*/</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>class</code> <code>Example {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<h3>Functions and methods</h3>
<p>Functions and methods are documented identically in PhpDoc. (For those who may not be familiar with the terminology, a method is just a function within a class.) Functions and methods usually contain the <code>@param</code> and <code>@return</code> tags in their DocBlocks. The <code>@param</code> tag is used to document the expected type of a parameter. It contains three sections: the parameter, the data type, and an optional description. The <code>@return</code> tag is used to document the return type. It contains two sections: the data type and an optional description. In both tags, the data type can be either a valid PHP data type, a class name, or “mixed”. It can also contain multiple options separated by a pipe.</p>
<div id="highlighter_994680">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>&lt;?php</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>/**</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code> </code><code>* Finds and returns user by ID or username</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code> </code><code>*</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code> </code><code>* @param int|string $user Either an ID or a username</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code> </code><code>* @param PDO $pdo A valid PDO object</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code> </code><code>* @return User Returns User object or null if not found</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code> </code><code>*/</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>function</code> <code>getUser(</code><code>$user</code><code>, PDO </code><code>$pdo</code><code>)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>    </code><code>// ...</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>    </code><code>if</code> <code>(</code><code>$isFound</code><code>) {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>        </code><code>return</code> <code>new</code> <code>User(...);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>    </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>    </code><code>return</code> <code>null;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<h2>Generating Documentation</h2>
<p>Once you’ve documented your PHP code, you’ll want to generate user-friendly documentation from it. To do so, run the PhpDoc command-line tool.</p>
<pre>moteutsch@vivaldi:~$ <strong>phpdoc -d /path/to/files/ -t /path/to/docs/ -ti 'Documentation Title' -dn 'Default Package' -o HTML:frames:default</strong></pre>
<p>The <code>-d</code> option specifies a comma-separated list of directories containing files to document, and <code>-t</code> the path to generated docs. <code>-ti</code> is used to specify the project title, and <code>-dn</code> to set the default package name. Finally, <code>-o</code> specifies the documentation format. PhpDoc has a wide selection of formats to choose from. A full list is available on the <a href="http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html#using.command-line.output">PhpDoc website</a>.</p>
<p>You can find out more about the command-line tool by executing the help command as follows:</p>
<pre>moteutsch@vivaldi:~$ <strong>phpdoc -h</strong></pre>
<p>Once you run the command, the documentation path you specified should contain the generated docs.</p>
<p>For those of you who aren’t comfortable using the command-line interface, PhpDoc also has a web interface available. It’s outside of this articles scope to discuss it at length, but you can read more about it on PhpDoc’s official website, <a href="http://phpdoc.org/">phpdoc.org</a>.</p>
<h2>Summary</h2>
<p>In this article I’ve given you a first look at PhpDoc and its many powerful features. I have explained the purpose of DocBlocks and their components; I have shown you how to organize your documentation using packages; I have explained which code elements can be documented and some common examples of doing so; finally, I have shown you how to generate documentation from your source code. I highly recommend that you start using PhpDoc in your own projects, if even only to document the most important parts. It is very straight-forward and will save you and your co-workers countless hours of nail-biting and hair-pulling.</p>
<p><small>Image via <a href="http://www.shutterstock.com/gallery-599005p1.html">Zadorozhnyi Viktor</a> / <a href="http://www.shutterstock.com/">Shutterstock</a></small></p>
<p><a href="http://phpmaster.com/introduction-to-phpdoc/" target="_blank">Original Post &gt;&gt;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://php-webdevelopment-services.com/introduction-to-phpdoc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ClamAV as a Validation Filter in Zend Framework</title>
		<link>http://php-webdevelopment-services.com/clamav-as-a-validation-filter-in-zend-framework/</link>
		<comments>http://php-webdevelopment-services.com/clamav-as-a-validation-filter-in-zend-framework/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 14:19:04 +0000</pubDate>
		<dc:creator>Web Developer - Mirza Ahtasham Ahmad</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://php-webdevelopment-services.com/?p=238</guid>
		<description><![CDATA[<p>Ok, so you’re pretty comfortable with using the Zend Framework, specifically the use of Forms. Along with that, you have a good working knowledge of how to combine a host of <a href="http://framework.zend.com/manual/en/zend.validate.html">standard validators</a> such as CreditCard, EmailAddress, Db_RecordExists, and Hex, and <a href="http://framework.zend.com/manual/en/zend.filter.html">standard filters</a>such as Compress/Decompress, BaseName, Encrypt, and RealPath. But what do you do when a situation arises that’s outside the scope of the [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, so you’re pretty comfortable with using the Zend Framework, specifically the use of Forms. Along with that, you have a good working knowledge of how to combine a host of <a href="http://framework.zend.com/manual/en/zend.validate.html">standard validators</a> such as <em>CreditCard</em>, <em>EmailAddress</em>, <em>Db_RecordExists</em>, and <em>Hex</em>, and <a href="http://framework.zend.com/manual/en/zend.filter.html">standard filters</a>such as <em>Compress/Decompress</em>, <em>BaseName</em>, <em>Encrypt</em>, and <em>RealPath</em>. But what do you do when a situation arises that’s outside the scope of the pre-packaged validators and filters?</p>
<p>Let’s say you want to guard against users uploading files that contain viruses, for example. You would have to write a custom validator that checks the uploads aren’t infected. Today I’ll show you how to do just that – how to write a new file validation filter for Zend Framework that uses <a href="http://www.clamav.net/lang/en/">ClamAV</a>to ensure uploaded files are virus-free.</p>
<h2>Adding ClamAV Support to PHP</h2>
<p>First you’ll need to install ClamAV support. I’m basing this installation procedure around Linux, specifically Ubuntu. If you’re using another distribution, you may need to adjust the commands accordingly. Unfortunately, if you’re using Windows however, you’ll need to use a Linux-based Virtual Appliance or setup a virtual machine running Linux to follow along since the php-clamav extension doesn’t support Windows as yet.</p>
<p>Before you attempt to install ClamAv, ensure that you have the library’s dependencies installed. You’ll also want to make sure you have the PHP dev package installed so <code>phpize</code> is available. You can do this by running the following command:</p>
<pre>msetter@tango:~$ <strong>sudo apt-get install php5-dev libclamav-dev clamav libclamav6 clamav-freshclam</strong></pre>
<p>Once you have the dependencies installed, grab a copy of the php-clamav library from<a href="http://sourceforge.net/projects/php-clamav">sourceforge.net/projects/php-clamav</a> and extract it to a temporary directory on your system. Navigate into the extracted library’s directory and run the following commands:</p>
<pre>msetter@tango:~/php-clamav$ <strong>phpize</strong>
msetter@tango:~/php-clamav$ <strong>./configure --with-clamav</strong>
msetter@tango:~/php-clamav$ <strong>make</strong></pre>
<p>If they all execute without errors, you’ll find a newly compiled module in the modules subdirectory. Copy the module to the directory in which the rest of your PHP modules reside. Your system may vary, but I was able to do it with:</p>
<pre>msetter@tango:~/php-clamav$ <strong>sudo cp modules/clamav.so /usr/lib/php5/20090626+lfs/</strong></pre>
<p>You then need to enable the module in PHP’s configuration file. This is done pretty simply by adding the following line to <code>php.ini</code> and restarting Apache:</p>
<pre>extension=clamav.so</pre>
<p>Finally, either run <code>php -i</code> from the command line or execute a simple PHP script that contains just a call to <code>phpinfo()</code> to verify the new extension is enabled. You should see output similar to that below.</p>
<p><img title="clamav extension in phpinfo output" src="http://cdn.phpmaster.com/files/2012/01/zf-clamav-01.png" alt="clamav extension in phpinfo output" width="642" height="143" /></p>
<p>The ClamAv library comes with a series of constants and functions, but in this article I will focus on just two functions, <code>cl_scanfile()</code> and <code>cl_pretcode()</code>, as all you need to do is scan the uploaded file and report what the virus is if one is found. For more information on the other available functions visit <a href="http://php-clamav.sourceforge.net/">php-clamav.sourceforge.net</a>.</p>
<h2>Building the File Upload Validator</h2>
<p>Now that the extension is installed and enabled, let’s get underway and build the Zend Framework ClamAV file upload validator. I’ll assume that you already have a working Zend Framework project which has module support enabled and ready to go. Add support for the new validation library by adding the following line to your <code>application.ini</code> file:</p>
<pre>autoloaderNamespaces[] = "Common_"</pre>
<p>Then, under the library directory of your Zend Framework project root, create the directory<code>Common/Validate/File</code> and within it a file named <code>ClamAv.php</code> with the following content:</p>
<div id="highlighter_985866">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>&lt;?php</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>class</code> <code>Common_Validate_File_ClamAv </code><code>extends</code> <code>Zend_Validate_Abstract</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>With that, your new validator class will be available to the project.</p>
<p>If you’re not familiar with validators in Zend Framework, they’re a pretty straight-forward affair. You can either extend them from <code>Zend_Validate_Abstract</code> or <code>Zend_Validate_Interface</code>. For the purposes of this example, I’m basing the validator on the former. Given that, you will only have to implement two methods: the constructor and <code>isValid()</code>.</p>
<p>The constructor should check whether the ClamAv extension is loaded as it’s not shipped with a standard distribution of PHP.</p>
<p>The <code>isValid()</code> method will perform the core work of the validator. Normally the method validates some input and either returns true if the validation was successful or sets an error message in the errors list that is shown afterwards and returns false if the validation failed. Depending on the configuration of your form validators, returning false will either halt the form validation at that point or let the remaining validators continue to run.</p>
<p>Fill out the <code>Common_Validate_File_ClamAv</code> class so it looks like this:</p>
<div id="highlighter_291318">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>&lt;?php</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>class</code> <code>Common_Validate_File_ClamAv </code><code>extends</code> <code>Zend_Validate_Abstract</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>const</code> <code>STATUS_CLEAN = 0;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>const</code> <code>NOT_READABLE = </code><code>"fileNotReadable"</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>    </code><code>const</code> <code>FILE_INFECTED = </code><code>"fileInfected"</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>protected</code> <code>$_messageTemplates</code> <code>= </code><code>array</code><code>(</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>        </code><code>self::FILE_INFECTED =&gt; </code><code>"File '%value%' is infected"</code><code>,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>        </code><code>self::NOT_READABLE =&gt; </code><code>"File '%value%' is not readable"</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>    </code><code>public</code> <code>function</code> <code>__construct() {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>        </code><code>if</code> <code>(!</code><code>extension_loaded</code><code>(</code><code>'clamav'</code><code>)) {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>            </code><code>throw</code> <code>new</code> <code>Zend_Validate_Exception(</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>                </code><code>"ClamAv extension is not loaded"</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>        </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>17</code></td>
<td><code>    </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>18</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>19</code></td>
<td><code>    </code><code>public</code> <code>function</code> <code>isValid(</code><code>$value</code><code>, </code><code>$file</code> <code>= null) {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>20</code></td>
<td><code>        </code><code>if</code> <code>(</code><code>$file</code> <code>=== null) {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>21</code></td>
<td><code>            </code><code>$file</code> <code>= </code><code>array</code><code>(</code><code>"type"</code> <code>=&gt; null, </code><code>"name"</code> <code>=&gt; </code><code>$value</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>22</code></td>
<td><code>        </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>23</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>24</code></td>
<td><code>        </code><code>if</code> <code>(!Zend_Loader::isReadable(</code><code>$value</code><code>)) {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>25</code></td>
<td><code>            </code><code>return</code> <code>$this</code><code>-&gt;_throw(</code><code>$file</code><code>, self::NOT_READABLE);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>26</code></td>
<td><code>        </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>27</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>28</code></td>
<td><code>        </code><code>$retcode</code> <code>= cl_scanfile(</code><code>$value</code><code>, </code><code>$virusname</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>29</code></td>
<td><code>        </code><code>if</code> <code>(</code><code>$retcode</code> <code>!== self::STATUS_CLEAN) {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>30</code></td>
<td><code>            </code><code>printf(</code><code>"File path: %s | Return code: %s | Virus found name: %s"</code><code>,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>31</code></td>
<td><code>                </code><code>$value</code><code>, cl_pretcode(</code><code>$retcode</code><code>), </code><code>$virusname</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>32</code></td>
<td><code>            </code><code>return</code> <code>$this</code><code>-&gt;_throw(</code><code>$file</code><code>, self::FILE_INFECTED);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>33</code></td>
<td><code>        </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>34</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>35</code></td>
<td><code>        </code><code>return</code> <code>true;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>36</code></td>
<td><code>    </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>37</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>38</code></td>
<td><code>    </code><code>protected</code> <code>function</code> <code>_throw(</code><code>$file</code><code>, </code><code>$errorType</code><code>) {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>39</code></td>
<td><code>        </code><code>$this</code><code>-&gt;_value = </code><code>$file</code><code>[</code><code>"name"</code><code>];</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>40</code></td>
<td><code>        </code><code>$this</code><code>-&gt;_error(</code><code>$errorType</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>41</code></td>
<td><code>        </code><code>return</code> <code>false;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>42</code></td>
<td><code>    </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>43</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>First a set of class constants are specified that define the return status for the virus check string templates for custom errors messages. Following that, the constructor checks for ClamAv support being available. If it’s not available, then an exception is thrown.</p>
<p>The <code>isValid()</code> method checks if it the incoming <code>$value</code> argument contains a filename and that the file is readable. If it is, then the <code>cl_scanfile()</code> function is called. The return code from<code>cl_scanfile()</code> indicates whether the file is virus-free. If not, then the name of the virus is retrieved using the <code>cl_pretcode()</code> function and the information is printed.</p>
<p>The <code>_throw()</code> method takes care of setting the appropriate error constant in the class and returning false to indicate that validation has failed. If this happens, the error message linked to the constant will be displayed in the upload form through the use of an error decorator on the input element.</p>
<h2>Testing the Validator</h2>
<p>With the validator written, you’ll need a form to make use of it and test that it works. Either manually or with <code>zf.sh</code>, create a new action in the <code>IndexController</code> class of the default module and call it “fileUpload”. Add the following code to it:</p>
<div id="highlighter_772240">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>&lt;?php</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>class</code> <code>IndexController </code><code>extends</code> <code>Zend_Controller_Action</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>...</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>public</code> <code>function</code> <code>fileUploadAction() {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>        </code><code>$form</code> <code>= </code><code>new</code> <code>Zend_Form();</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>        </code><code>$form</code><code>-&gt;setAction(</code><code>"/default/index/file-upload"</code><code>)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>             </code><code>-&gt;setMethod(</code><code>"post"</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>        </code><code>$uploadFile</code> <code>= </code><code>new</code> <code>Zend_Form_Element_File(</code><code>"uploadfile"</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>        </code><code>$uploadFile</code><code>-&gt;addValidator(</code><code>new</code> <code>Common_Validate_File_ClamAv())</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>           </code><code>-&gt;setRequired(true)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>           </code><code>-&gt;setLabel(</code><code>"Upload file:"</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>        </code><code>$form</code><code>-&gt;addElement(</code><code>$uploadFile</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>        </code><code>$form</code><code>-&gt;addElement(</code><code>new</code> <code>Zend_Form_Element_Submit(</code><code>"submit"</code><code>));</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>17</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>18</code></td>
<td><code>        </code><code>if</code> <code>(</code><code>$form</code><code>-&gt;isValid(</code><code>$_POST</code><code>)) {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>19</code></td>
<td><code>            </code><code>$values</code> <code>= </code><code>$form</code><code>-&gt;getValues();</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>20</code></td>
<td><code>            </code><code>$this</code><code>-&gt;view-&gt;messages = </code><code>array</code><code>(</code><code>"File uploaded"</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>21</code></td>
<td><code>        </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>22</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>23</code></td>
<td><code>        </code><code>$this</code><code>-&gt;view-&gt;form = </code><code>$form</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>24</code></td>
<td><code>    </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>25</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>Here you’ve created a simple form and set its action and method properties, a submit button, and a file element. The newly created ClamAv file validator is added to the file element. In addition, the required flag Is set to true ensuring that a file must be uploaded. Following this, both elements are added to the form and a simple if statement checks whether the form has been submitted.</p>
<p>If the form doesn’t validate after being submitted (i.e. the file has a virus), then a validation message will be displayed using the standard error message decorator. Otherwise, a message is added to the view’s messages which will be displayed to the user to indicate the upload was successful.</p>
<p>The last piece is the view script, which is shown below:</p>
<div id="highlighter_979105">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>&lt;h1&gt;Zend Framework - ClamAV File Upload Validator&lt;/h1&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>&lt;?php</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>if</code> <code>(</code><code>count</code><code>(</code><code>$this</code><code>-&gt;messages)) {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>echo</code> <code>'&lt;ul id="messages"&gt;'</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>foreach</code> <code>(</code><code>$this</code><code>-&gt;messages </code><code>as</code> <code>$message</code><code>) {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>        </code><code>echo</code> <code>"&lt;li&gt;"</code> <code>. </code><code>$this</code><code>-&gt;escape(</code><code>$message</code><code>) . </code><code>"&lt;/li&gt;"</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>echo</code> <code>"&lt;/ul&gt;"</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>echo</code> <code>$this</code><code>-&gt;form;</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>As the lions share of the work already taken care of by the controller and the validator, the view script doesn’t need to do a lot. It simply displays any messages that have been set by the controller and renders the form.</p>
<h2>Summary</h2>
<p>After working through all that code, you now have a new validator for the Zend Framework that, via the PHP ClamAv library, will check if a file is virus free. I hope that you found this article helpful, both for showing how to create your own custom validators in the Zend Framework and for being able to ensure that you have virus free uploads in the applications that you create from here on in. If you’d like to inspect the code further, a copy is <a href="https://github.com/phpmasterdotcom/ZFClamAvValidationFilter">available for cloning on GitHub</a>.</p>
<p><small>Image via <a href="http://www.shutterstock.com/gallery-577981p1.html">mathagraphics</a> / <a href="http://www.shutterstock.com/">Shutterstock</a></small></p>
<p>&nbsp;</p>
<p><a href="http://phpmaster.com/zf-clamav/" target="_blank">original post &gt;&gt;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://php-webdevelopment-services.com/clamav-as-a-validation-filter-in-zend-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why Conventions Matter</title>
		<link>http://php-webdevelopment-services.com/why-conventions-matter/</link>
		<comments>http://php-webdevelopment-services.com/why-conventions-matter/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 14:15:22 +0000</pubDate>
		<dc:creator>Web Developer - Mirza Ahtasham Ahmad</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://php-webdevelopment-services.com/?p=235</guid>
		<description><![CDATA[<p>When I started teaching myself scripting languages, I started with Perl. One Perl motto is<a href="http://en.wikipedia.org/wiki/TMTOWTDI">&#8220;TMTOWTDI&#8221;</a> &#8211; &#8220;There&#8217;s More Than One Way To Do It,&#8221; and pronounced &#8220;tim-toady.&#8221; The idea is that there&#8217;s likely multiple ways to accomplish the very same thing, and the culture of the language encourages finding novel ways to do things.</p> <p>I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>When I started teaching myself scripting languages, I started with Perl. One Perl motto is<a href="http://en.wikipedia.org/wiki/TMTOWTDI">&#8220;TMTOWTDI&#8221;</a> &#8211; &#8220;There&#8217;s More Than One Way To Do It,&#8221; and pronounced &#8220;tim-toady.&#8221; The idea is that there&#8217;s likely multiple ways to accomplish the very same thing, and the culture of the language encourages finding novel ways to do things.</p>
<p>I&#8217;ve seen this principle used everywhere and in just about every programming situation possible, applied to logical operations, naming conventions, formatting, and even project structure. Everyone has an opinion on these topics, and given free rein to implement as they see fit, it&#8217;s rare that two developers will come up with the same conventions.</p>
<p>TMTOWTDI is an incredibly freeing and egalitarian principle.</p>
<p>Over the years, however, my love for TMTOWTDI has diminished some. Freeing as it is, is also a driving force behind having coding standards and conventions &#8212; because when everyone does it their own way, projects become quickly hard to maintain. Each person finds themselves reformatting code to their own standards, simply so they can read it and follow its flow.</p>
<p>Additionally, TMTOWTDI can actually be a foe of simple, elegant solutions.</p>
<p>Why do I claim this?</p>
<p>Recently, discussing module structure in Zend Framework 2, some folks were arguing that our recommended directory structure invokes the <a href="http://en.wikipedia.org/wiki/YAGNI">YAGNI</a> principle: You Ain&#8217;t Gonna Need It. Our recommendation is this:</p>
<div>
<pre>ModuleName/
    autoload_classmap.php
    Module.php
    config/
        module.config.php
        (other config files)
    public/
        css/
        images/
        js/
    src/
        ModuleName/
            (source files)
    test/
    view/</pre>
</div>
<p>The argument is that since most modules implement a single namespace, and because we recommend following <a href="https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md">PSR-0</a> for autoloaders, it makes sense to simply have the source files directly under the module directory.</p>
<div>
<pre>ModuleName/
    autoload_classmap.php
    Module.php
    (other source files)
    config/
        module.config.php
        (other config files)
    public/
    test/
    view/</pre>
</div>
<p>The argument myself and others made was that it makes sense to group the files by responsibility. However, the module system ultimately <em>doesn&#8217;t care</em> how you organize the module &#8212; we&#8217;ve embraced TMTOWTDI, and our only requirement is that for your module to be consumed, you must define a<code>ModuleName\Module</code> class, and notify the module manager how to find it. Anything goes.</p>
<p>How does that bolster my argument about the importance of conventions? It doesn&#8217;t. What does is what following the recommended structure enabled me to do.</p>
<p>One common concern identified with having a re-usable module system is that you should be able to expose public assets easily: things like module-specific CSS or JavaScript, or even images. The first question that arises when you consider this is: where do I put them in my module? That&#8217;s why the recommendation includes a <code>public</code> directory. In fact, the recommendation goes a step further, and suggests <code>css</code>, <code>images</code>, and <code>js</code> directories as well.</p>
<p>Now, your modules are typically <em>outside</em> the document root. This is a rudimentary and fundamental security measure, and also simplifies deployment to a degree &#8212; you don&#8217;t need to worry about telling the web server about what it <em>shouldn&#8217;t</em> serve. But if the modules are outside the document root, how can I expose their public assets?</p>
<p>There are a two possibilities that immediately jump to mind:</p>
<ul>
<li>Install scripts for modules, which copy the files into the document root.</li>
<li>Symlink the files into the document root.</li>
</ul>
<p>Both are valid, and easy to accomplish. Both raise the same question: where, exactly? What if multiple modules have public assets named the same? how do I refer to my assets withing things like view scripts?</p>
<p>This is where having a convention starts to make sense: having a convention should answer these questions unambiguously.</p>
<p>My answer: public access should be at <code>/css/ModuleName/stylesheetname</code>, or<code>/js/ModuleName/scriptname</code> or <code>/images/Modulename/imagename</code>. It&#8217;s a dirt-simple rule that fulfills the use cases.</p>
<p>However, I&#8217;m now stuck with having to develop either install scripts or remembering to create symlinks &#8212; ugh. And that&#8217;s where having conventions led me to a simple, elegant solution.</p>
<p>I added one line to my Apache vhost definition:</p>
<div>
<pre>AliasMatch /(css|js|images)/([^/]+)/(.*) /path/to/module/$2/public/$1/$3</pre>
</div>
<p>The translation:</p>
<blockquote><p>When I come across a path to CSS, JS, or image files that are in a subdirectory, alias it to the corresponding public asset of the matched module directory.</p></blockquote>
<p>I dropped this into my vhost, restarted Apache, and now not only were the assets I&#8217;d created already served, but any new ones I create are immediately available as well. Having a convention actually simplified my choices and my solutions.</p>
<p>Rapid application development at its finest.</p>
<p>My point is this: there will always be more than one way to do things when you&#8217;re programming, and you may not always agree with the decisions your team has made, or the component library or framework you&#8217;re using has made. However, if you poke around a little and play within those confines, you may find that those decisions make other decisions easier, or disappear altogether.</p>
<p>&nbsp;</p>
<p><a title="Why Conventions Matter" href="http://mwop.net/blog/why-conventions-matter" target="_blank">Original post &gt;&gt;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://php-webdevelopment-services.com/why-conventions-matter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why You Need To Hire a Web Developer for Your Business Website</title>
		<link>http://php-webdevelopment-services.com/why-you-need-to-hire-a-web-developer-for-your-business-website/</link>
		<comments>http://php-webdevelopment-services.com/why-you-need-to-hire-a-web-developer-for-your-business-website/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 20:52:06 +0000</pubDate>
		<dc:creator>Web Developer - Mirza Ahtasham Ahmad</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Web Designing]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://php-webdevelopment-services.com/?p=230</guid>
		<description><![CDATA[<p>If you have just launched a new business or updating your existing one, a business website will be very beneficial. Websites are a great way to advertise your company and your products to a wide range of different customers all around the world. In order to set up a website, you will need to hire [...]]]></description>
			<content:encoded><![CDATA[<p>If you have just launched a new business or updating your existing one, a business website will be very beneficial. Websites are a great way to advertise your company and your products to a wide range of different customers all around the world. In order to set up a website, you will need to hire a <strong>web developer</strong>.</p>
<p>There are many reasons why you should hire a <strong>website developer</strong> as he or she will do much more than just create a business website for your company. The developer will create a website that will provide functionality and great content to make sure your customers keep visiting your website. Most important he or she will provide you with internet marketing techniques to increase the number of viewers to your website though search engine results.  There are many different internet marketing techniques that the developer will help you with but the most common one is word of mouth with the use of forums and blogs to promote your business.</p>
<p>Another reason why you should hire a professional is because he or she will create an effective website that is unique, easy to use, pleasant to the eye and will load on all browsers efficiently.  If your website does not have a professional image, you can lose customers. So you need to make sure that your website is created by a professional so that your potential customers keep visiting.</p>
<p>Instead of making the website yourself, you can hire a <strong>web designer</strong>, which will save you a lot of time. So make sure that your hire someone that is good at what he or she does because you want someone who will develop an effective website and be there to advice you with internet marketing techniques when you need it the most. Create a website with a help of a professional developer today and be an owner of a successful business that you have always wanted to be.</p>
]]></content:encoded>
			<wfw:commentRss>http://php-webdevelopment-services.com/why-you-need-to-hire-a-web-developer-for-your-business-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Where Should You Hire A Freelance Web Designer From?</title>
		<link>http://php-webdevelopment-services.com/where-should-you-hire-a-freelance-web-designer-from/</link>
		<comments>http://php-webdevelopment-services.com/where-should-you-hire-a-freelance-web-designer-from/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 20:49:12 +0000</pubDate>
		<dc:creator>Web Developer - Mirza Ahtasham Ahmad</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Web Designing]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://php-webdevelopment-services.com/?p=228</guid>
		<description><![CDATA[<p>Web presence is becoming increasingly popular because goals are easy to achieve when a business or an individual has online presence. This therefore implies that one uses professional web designing services if they are to have a website that will lead to the realization of these goals. Web services are easily provided by firms or [...]]]></description>
			<content:encoded><![CDATA[<p>Web presence is becoming increasingly popular because goals are easy to achieve when a business or an individual has online presence. This therefore implies that one uses professional web designing services if they are to have a website that will lead to the realization of these goals. Web services are easily provided by firms or freelancers, though the latter are becoming the preferred choice for many. Freelancers are easier to deal with, cheaper and more accessible. A <strong>freelance website designer</strong> is able to offer his services any time they are needed since they are not bound by company regulations.  </p>
<p>What you need to be clear on is whether you need a website designer who also has <strong>freelance web development</strong> experience. Many people tend to assume that a designer is also a developer though there is a marked difference between the two. There are many reliable places to hire a web designer. The most popular one is by word of mouth or referrals. Asking friends or colleagues who have sought similar services and have been satisfied with the outcome is one way to go about it. Other places of hire are web design fora, networks and job boards where one can check to see if there are any designers or firms offering their services. Advertisements can also be placed here.</p>
<p>Another good place to find a designer or a <strong>freelance web programmer</strong> are web galleries where top class web designs are on exhibit as well as their designers. There are many web design trading sites or marketplaces as well where freelance designers advertise their services. If you have a limited budget, online bidding sites are the best places to get affordable <strong>freelance website development</strong> services.</p>
<p>To avoid disappointment, being conned or making losses, always remember to hire your web designers from places of good repute. </p>
]]></content:encoded>
			<wfw:commentRss>http://php-webdevelopment-services.com/where-should-you-hire-a-freelance-web-designer-from/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How Much Will A Freelance Web Designer Cost You?</title>
		<link>http://php-webdevelopment-services.com/how-much-will-a-freelance-web-designer-cost-you/</link>
		<comments>http://php-webdevelopment-services.com/how-much-will-a-freelance-web-designer-cost-you/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 20:46:18 +0000</pubDate>
		<dc:creator>Web Developer - Mirza Ahtasham Ahmad</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Web Designing]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://php-webdevelopment-services.com/?p=226</guid>
		<description><![CDATA[<p>Websites play a significant role in our present world. A good and properly maintained website has many benefits to both its owner and users. A lot of effort is required for one to have a site that will attract the right audience and maintain regular traffic flow. A qualified but affordable website designer can make [...]]]></description>
			<content:encoded><![CDATA[<p>Websites play a significant role in our present world. A good and properly maintained website has many benefits to both its owner and users. A lot of effort is required for one to have a site that will attract the right audience and maintain regular traffic flow. A qualified but <strong>affordable website designer</strong> can make this a reality. One of the main challenges of hiring a designer has to do with costs. This is where using a freelancer web designer comes in handy as they are generally cheaper when compared to web firms or companies.</p>
<p>The first thing you have to consider before hiring a web designer is to be clear on what you want for your website. From example, it could be that apart from your site being designed, there is need for it to be developed as well. In this case, it is cost effective to employ a designer who is also qualified in <strong>website development</strong>. </p>
<p>Freelancer web designer costs vary and depend on:</p>
<p>1)	Project size – the bigger the project, the higher the cost<br />
2)	Complexity of the website –The more time, skills or products needed for the website, the higher web designer costs.<br />
3)	 Volunteer services are likely to be free or cheaper.<br />
4)	Experience and qualifications of designer – the more qualified or experienced the designer, the higher the charges.<br />
5)	Revisions &#8211; The more revisions done, the higher the cost.<br />
6)	Whether the <strong>web development</strong> tools are free or not – in situations where the designer is able to access free designing tools, his charges are likely to be lower.</p>
<p>The best way to find a web designer whose charges are within your budget is to do some research until you get one that fits your needs. It is worth noting that the best things in life come at a price. </p>
]]></content:encoded>
			<wfw:commentRss>http://php-webdevelopment-services.com/how-much-will-a-freelance-web-designer-cost-you/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How can your website help you build your business?</title>
		<link>http://php-webdevelopment-services.com/how-can-your-website-help-you-build-your-business/</link>
		<comments>http://php-webdevelopment-services.com/how-can-your-website-help-you-build-your-business/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 20:43:52 +0000</pubDate>
		<dc:creator>Web Developer - Mirza Ahtasham Ahmad</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Designing]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://php-webdevelopment-services.com/?p=224</guid>
		<description><![CDATA[<p>In order to build an interface for the clients, the business owners need to develop a website which provides information about the company and its products or services. It is the medium to represent their business online and to drive sales up to a new level. Therefore, it should be designed in the way that [...]]]></description>
			<content:encoded><![CDATA[<p>In order to build an interface for the clients, the business owners need to develop a website which provides information about the company and its products or services. It is the medium to represent their business online and to drive sales up to a new level. Therefore, it should be designed in the way that is easy for the people to access and should be compatible on a number of browsers. </p>
<p>There are several ways that business owners can design their website. They can design it themselves using software easily available everywhere on internet. However, in order to help build their business, it is essential that they hire a professional web designer with sufficient knowledge in PHP program, SEO and HTML.With adequate knowledge of SEO, a professional can bring leads for their business and can enhance their business or brand to a large number of audiences. </p>
<p>For many businesses, <strong>hiring freelance web designer</strong> to design their website is a comparatively cheaper option. They can be hired from freelance sites like Elance. By assigning different jobs to different freelancers; business owners can <strong>hire PHP programmer</strong> and <strong>freelance website developer</strong>; each completing their task side by side. This can help build their website in much less time as compared to designing it themselves or hiring one freelancer for all of these jobs. </p>
<p>By <strong>hiring freelance web developers</strong>, business can expand their business online by selling products online, saving a lot of money that they previously used for taking orders through service centre or physical stores. Therefore, spending a few dollars in getting their website designed through a professional can bring long term profits to the business.</p>
]]></content:encoded>
			<wfw:commentRss>http://php-webdevelopment-services.com/how-can-your-website-help-you-build-your-business/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Differentiating the Good from the Bad &#8211; The Importance of Interviewing Your Web Designer before Signing a Contract.</title>
		<link>http://php-webdevelopment-services.com/differentiating-the-good-from-the-bad-the-importance-of-interviewing-your-web-designer-before-signing-a-contract/</link>
		<comments>http://php-webdevelopment-services.com/differentiating-the-good-from-the-bad-the-importance-of-interviewing-your-web-designer-before-signing-a-contract/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 20:39:52 +0000</pubDate>
		<dc:creator>Web Developer - Mirza Ahtasham Ahmad</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Web Designing]]></category>

		<guid isPermaLink="false">http://php-webdevelopment-services.com/?p=222</guid>
		<description><![CDATA[<p>Internet use has increased over the years. This, in turn, has led to an increased number of web professionals to meet the demand for web services. There are all sorts of web designers these days and unless one is web savvy, the chances of getting a raw deal are very real. This therefore calls for [...]]]></description>
			<content:encoded><![CDATA[<p>Internet use has increased over the years. This, in turn, has led to an increased number of web professionals to meet the demand for web services. There are all sorts of web designers these days and unless one is web savvy, the chances of getting a raw deal are very real. This therefore calls for caution when there is need to <strong>hire web designer</strong> professionals and thus the importance of interviewing any web designer before any contract is signed. Interviews allow you to gauge the web designer’s suitability for the job. Many website owners tend to overlook the interviewing process, leading to very undesirable outcomes. </p>
<p>When interviewing a web designer, one should look out for the following:</p>
<p>•	Qualifications – The best way to determine this is to ask to see the designer’s portfolio, consult his past clients, and/or test him on a small project.<br />
•	Communication skills – He should be a good listener with the ability to explain the technical aspects of the job in a language you can understand. He should be accommodative of your ideas without compromising on the project quality. Promptness is essential.<br />
•	Ability to acknowledge weakness &#8211; For example, he should readily admit if he is lacking in other web skills like PHP or programming. This will help you to decide whether or not to hire a <strong>php programmer</strong> or a <strong>web programmer</strong>.<br />
•	Ability to work beyond expectations<br />
•	Respectful and have passion for profession<br />
•	Up to date with the latest web technology</p>
<p>At the point of signing the contract, both parties should be in agreement on the quality, duration, budget, timeline, and deliverables of the project. </p>
<p>These interviewing basics are also applicable when you are looking to <strong>hire web developer</strong> professionals. This way you get the best candidate at the best price. </p>
]]></content:encoded>
			<wfw:commentRss>http://php-webdevelopment-services.com/differentiating-the-good-from-the-bad-the-importance-of-interviewing-your-web-designer-before-signing-a-contract/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Benefits of hiring a professional web designer</title>
		<link>http://php-webdevelopment-services.com/benefits-of-hiring-a-professional-web-designer/</link>
		<comments>http://php-webdevelopment-services.com/benefits-of-hiring-a-professional-web-designer/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 20:33:08 +0000</pubDate>
		<dc:creator>Web Developer - Mirza Ahtasham Ahmad</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Web Designing]]></category>

		<guid isPermaLink="false">http://php-webdevelopment-services.com/?p=219</guid>
		<description><![CDATA[<p>The business owners need to develop a website which can efficiently and effectively bring the required traffic to the site. For this purpose it is important for the companies to hire professional web designers with sufficient knowledge in areas like PHP programming, SQL, SEO and HTML rather than attempting to design it themselves.</p> <p>There are [...]]]></description>
			<content:encoded><![CDATA[<p>The business owners need to develop a website which can efficiently and effectively bring the required traffic to the site. For this purpose it is important for the companies to hire professional web designers with sufficient knowledge in areas like PHP programming, SQL, SEO and HTML rather than attempting to design it themselves.</p>
<p>There are two possible ways for hiring a professional web designer; either going for a company offering the service or to <strong>hire freelance web designer</strong>. If the company opts to go for freelance professional web designer, it is cheaper as you can go to them for any updates, maintenance and other designs later, being their loyal customers. There is a need for the companies to <strong>hire freelance web designer</strong> and also the need to <strong>hire freelance web developer</strong>. Both have different functions, former being responsible for graphics of design while latter being responsible for the programming code. It is important to hire a professional web designer proficient in doing both the jobs as it will help save time.</p>
<p>A benefit of hiring a professional web designer is that they are aware of advancements and new innovations being made in the field of technology and its use. Moreover, a professional web designer knows the job of a PHP programmer which is the core component essential for web development. The companies usually <strong>hire freelance PHP programmer</strong> in order to make the website more professional looking and compatible on various browsers. The professional web designer can perform the job of the <strong>freelance PHP programmer</strong> possessing sufficient knowledge of PHP program. Therefore, it saves both time and money hiring different people for a job which can be done by one person.</p>
]]></content:encoded>
			<wfw:commentRss>http://php-webdevelopment-services.com/benefits-of-hiring-a-professional-web-designer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How a PHP Developer Can Help You Develop a Dynamic Website</title>
		<link>http://php-webdevelopment-services.com/how-a-php-developer-can-help-you-develop-a-dynamic-website/</link>
		<comments>http://php-webdevelopment-services.com/how-a-php-developer-can-help-you-develop-a-dynamic-website/#comments</comments>
		<pubDate>Sat, 31 Dec 2011 21:46:54 +0000</pubDate>
		<dc:creator>Web Developer - Mirza Ahtasham Ahmad</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[dynamic sites]]></category>
		<category><![CDATA[dynamic web design]]></category>
		<category><![CDATA[dynamic website]]></category>
		<category><![CDATA[dynamic websites]]></category>
		<category><![CDATA[PHP developer]]></category>
		<category><![CDATA[php programmer]]></category>

		<guid isPermaLink="false">http://php-webdevelopment-services.com/?p=128</guid>
		<description><![CDATA[Dynamic websites have pages that change every time you load them, without making any changes. But if you click on some images or texts, and then the content of the website may change according to what you have clicked. These websites have a linked database, where changes made to the database can be seen on the web page. These types of websites are great for online calendars, galleries or even e-commerce companies.]]></description>
			<content:encoded><![CDATA[<p>Websites are an important part of any profession as they help create a strong image for the company. How effective your website is all comes down to the <a title="web design" href="http://php-webdevelopment-services.com/">web design</a> you have used, therefore it is important that you focus on the structure, layout and the company’s content. The website can be either static or dynamic; however dynamic websites are becoming popular day-by-day.</p>
<p><strong>What Is A Dynamic Website?</strong></p>
<p><strong>Dynamic websites</strong> have pages that change every time you load them, without making any changes. But if you click on some images or texts, and then the content of the website may change according to what you have clicked. These websites have a linked database, where changes made to the database can be seen on the web page. These types of websites are great for online calendars, galleries or even e-commerce companies.</p>
<p>You can either make the dynamic website yourself with the help of tutorials if you have some knowledge on web designing. However, to make it easier for you, you can easily <a title="hire PHP developer" href="http://php-webdevelopment-services.com/">hire PHP developer</a> you will give you want you want for a small fee.</p>
<p><strong>What Is PHP?</strong></p>
<p>PHP is a scripting language on the internet that has become popular over time. It stands for Hypertext Pre-processor and it is a type of a programming code similar to HTML but dynamic and functional. It is a server sided language, where it loads up on the server rather than the user’s computer. Once it has loaded or executed, the results appear in your browser.</p>
<p><strong>How Can PHP Developers Help Me?</strong></p>
<p>Dynamic websites with <strong>PHP programming</strong> can make your website effective just by creating a great experience for your visitors and PHP developers will help you do just that. They will make your website interactive, functional and most of all make it interesting. With the help of <strong>PHP developers</strong>, you can create secure login pages, photo galleries, mailing lists, forums and they can also help you with your e-commerce solutions such as shopping carts and payment integration.</p>
<p><strong>Hire A PHP Developer for Your Business Needs</strong></p>
<p>If you have an e-commerce website for your company, then hiring a <strong>PHP developer</strong> will help you build a successful website that will help you compete in the competitive online market. These <a title="PHP programmers" href="http://php-webdevelopment-services.com/">PHP programmers</a> will help you develop quality websites with a professional look to them. With a good quality layout, structure and content, you will be able to portray an effective brand image among your online customers all around the world.</p>
<p><strong>How to Find PHP Developers?</strong></p>
<p>Looking for the right PHP developer is not easy, especially when you are a newbie at dynamic websites and PHP programming. In order to find the right developer, you will need to find some of the top developers on the internet and then go through what they have to offer you. You can even read customer reviews to get a rough idea of what to expect from them. With a little effort and time put in finding the right developer, can do wonders for your company.</p>
<p>So, if you want to create a dynamic website that is interesting, interactive and use friendly, then hire good <strong>PHP developers</strong> that will help you build just that. Create an interesting website today that brings people back to the website and see the brand image of your company shine in no time.</p>
]]></content:encoded>
			<wfw:commentRss>http://php-webdevelopment-services.com/how-a-php-developer-can-help-you-develop-a-dynamic-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

