<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Sat, 25 May 2013 01:49:01 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[NetTuts.com: How to Write Testable and Maintainable Code in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/19594</guid>
      <link>http://www.phpdeveloper.org/news/19594</link>
      <description><![CDATA[<p>
NetTuts.com has a new tutorial posted suggesting a few ways you can make <a href="http://net.tutsplus.com/tutorials/php/how-to-write-testable-and-maintainable-code-in-php/">testable and maintainable code</a> in PHP applications.
</p>
<blockquote>
Frameworks provide a tool for rapid application development, but often accrue technical debt as rapidly as they allow you to create functionality. Technical debt is created when maintainability isn't a purposeful focus of the developer. Future changes and debugging become costly, due to a lack of unit testing and structure. Here's how to begin structuring your code to achieve testability and maintainability - and save you time.
</blockquote>
<p>
There's a few concepts they cover in the tutorial including DRY (don't repeat yourself), working with dependency injection and actually writing the tests with PHPUnit. They start with a bit of code that needs some work and use the tests to help refactor it into something that can be easily mocked (using <a href="http://net.tutsplus.com/tutorials/php/mockery-a-better-way/">Mockery</a>). 
</p>
Link: http://net.tutsplus.com/tutorials/php/how-to-write-testable-and-maintainable-code-in-php]]></description>
      <pubDate>Thu, 16 May 2013 11:53:18 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Reddit.com: Login Security (Best Practices Recommendations)]]></title>
      <guid>http://www.phpdeveloper.org/news/18359</guid>
      <link>http://www.phpdeveloper.org/news/18359</link>
      <description><![CDATA[<p>
On Reddit.com there's a good conversation going on in the PHP category about <a href="http://www.reddit.com/r/PHP/comments/y4wuc/login_security/">login security</a> and best practices surrounding it.
</p>
<blockquote>
So I was handed an ancient project which was up to me to fix / improve. About a week later I am about done but there is 1 thing I left...Login security. As it is now, it's just md5(password) that's saved in the database. Better then nothing, but far from good enough. My plan was to have a constant pepper in the class which handles the logins, then do something like crypt(pepper . $password) to store it, since that should generate a random salt and is slower then sha1 / md5 / etc. I feel this should be save enough, do any of you have any ideas on how to improve it (without non-standard extensions)?
</blockquote>
<p>
There's lots of <a href="http://www.reddit.com/r/PHP/comments/y4wuc/login_security/#comments">comments</a> so far and a lot of them are following along the same lines - use a better method of encryption, something like <a href="http://php.net/manual/en/function.crypt.php">crypt</a> with Blowfish or something similar as well as some hashing (like <a href="http://php.net/manual/en/function.hash-hmac.php">HMAC</a>). 
</p>]]></description>
      <pubDate>Tue, 14 Aug 2012 12:20:08 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: PHPMaster Security Roundup]]></title>
      <guid>http://www.phpdeveloper.org/news/18240</guid>
      <link>http://www.phpdeveloper.org/news/18240</link>
      <description><![CDATA[<p>
Security has become more of a hot topic in the PHP community recently and PHPMaster.com has <a href="http://phpmaster.com/phpmaster-security-roundup/?">pulled together a list of resources</a> you can read up on to get some great ideas for securing your application.
</p>
<blockquote>
The unfortunate truth of the matter is there's no excuse for [the LinkedIn, Yahoo!, eHarmony and Last.fm] leaks; they would not have been possible if simple, well-known security precautions were taken. Are you protecting yourself and your applications by guarding against SQL-injection attacks? Are you filtering and validating user input? Are you properly hashing user passwords? I hope so! If not, read some of the security-focused articles PHPMaster has published throughout the past year and apply these best practices to your code today!
</blockquote>
<p>Articles in their list include:</p>
<ul>
<li><a href="http://phpmaster.com/why-you-should-use-bcrypt-to-hash-stored-passwords/">Why You Should Use Bcrypt to Hash Stored Passwords</a>
<li><a href="http://phpmaster.com/input-validation-using-filter-functions/">Input Validation Using Filter Functions</a>
<li><a href="http://phpmaster.com/multi-factor-authentication-with-php-and-twilio/">Multi-Factor Authentication with PHP and Twilio</a>
<li><a href="http://phpmaster.com/monitoring-file-integrity">Monitoring File Integrity</a>
</ul>
<p>
Check out the <a href="http://phpmaster.com/phpmaster-security-roundup/?">rest of the post</a> for links to other great articles.
</p>]]></description>
      <pubDate>Wed, 18 Jul 2012 09:22:07 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Jonas Hovgaard's Blog: How I stopped writing awesome code]]></title>
      <guid>http://www.phpdeveloper.org/news/18093</guid>
      <link>http://www.phpdeveloper.org/news/18093</link>
      <description><![CDATA[<p>
In <a href="http://jhovgaard.net/how-i-stopped-writing-awesome-code">this recent post</a> to his blog <i>Jonas Hovgaard</i> talks about how he "stopped writing awesome code" by dropping a few things from his usual development practices - like unit tests and interfaces.
</p>
<blockquote>
If writing awesome code is using all the best practices I can find, writing interfaces, unit tests and using top notch IoC containers to control my repositories and services all over my application's different layers - Then I'm not writing awesome code at all! I've been that guy, the one writing the awesome code, but I stopped. I'm not awesome any more. Instead, I'm productive, I'm so damn productive!
</blockquote>
<p>
He talks about how not writing unit tests (which "customers don't care about") gave him extra time to work on other code and how not using things like interfaces, ORMs and how he follows DRY, but only so far.
</p>
<blockquote>
My personal result of doing all of this is productivity and better products. I can't tell if I did it all wrong, and that's why I'm writing better code now, but I truly believe that I'm not alone. In fact I think that most of us regular web developers, tend to do the same "mistakes" as I did.
</blockquote>
<p>
The <a href="http://jhovgaard.net/how-i-stopped-writing-awesome-code">post</a> has turned into flame bait and has pulled in lots of comments discussing his decisions and other sympathetic souls that feel the same way he does about some of the complexity of the "best practices" promoted in development today.
</p>]]></description>
      <pubDate>Thu, 14 Jun 2012 11:55:21 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Input Validation Using Filter Functions]]></title>
      <guid>http://www.phpdeveloper.org/news/18038</guid>
      <link>http://www.phpdeveloper.org/news/18038</link>
      <description><![CDATA[<p>
On PHPMaster.com today there's a good tutorial that gives you some methods to do one of the most important things in any application - <a href="http://phpmaster.com/input-validation-using-filter-functions/">validating input</a>. Their examples show how to use some of PHP's own filter functions to accomplish this.
</p>
<blockquote>
Filter functions in PHP might not be sexy, but they can improve the stability, security, and even maintainability of your code if you learn how to use them correctly. In this article I'll explain why input validation is important, why using PHPs built-in functions for performing input validation is important, and then throw together some examples (namely using filter_input() and filter_var()), discuss some potential pitfalls, and finish with a nice, juicy call to action. 
</blockquote>
<p>
He talks about why validation is important to protect your application (and users) from malicious things like cross-site scripting. He emphasizes the use of PHP's own filter methods because they are established and, well, included in the language - no additional libraries needed. Example code is included showing how to use them to filter email addresses and check that something is an integer. 
</p>
<p>
You can find out more about these functions on their manual pages: <a href="http://php.net/filter_input"> filter_input</a>, <a href="http://php.net/filter_var">filter_var</a>.
</p>]]></description>
      <pubDate>Fri, 01 Jun 2012 15:53:28 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Seth May's Blog: The 5 Ws of Data Validation - Part 1]]></title>
      <guid>http://www.phpdeveloper.org/news/17871</guid>
      <link>http://www.phpdeveloper.org/news/17871</link>
      <description><![CDATA[<p>
With a reminder about the best practice of always validating your data, <i>Seth May</i> has <a href="http://blog.sethmay.net/2012/04/the-5-ws-of-data-validation/">this new post</a> about the "Five Ws" of validation - why, when, where and who.
</p>
<blockquote>
As web developers, the applications you write are complex data processing engines.  They try and convince your users to enter good, meaningful data and to respond in solid, predictable ways based on what was entered. Robust data validation will allow the rest of you application to work effectively. [...] Data is scrutinized in various ways to make sure that it adheres to basic restrictions and to fundamental properties.  It's no good receiving a sandwich when you expect a car.
</blockquote>
<p>The questions he answers are:</p>
<ul>
<li>Why is Data Validation Important?
<li>Where Should I be Validating Data?
<li>When Should My Data Be Validated?
<li>Who is Responsible for Validation?
<li>How Do I Validate My Data? (yes, there's a "w" in there!)
</ul>
<blockquote>
In the real world data is ugly, crazy, and untrustworthy. Your only hope to taming the data beast is to diligently, methodically validate your data.
</blockquote>]]></description>
      <pubDate>Thu, 26 Apr 2012 11:14:03 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[BinaryTides.com: 40+ Techniques to enhance your php code (3 Part Series)]]></title>
      <guid>http://www.phpdeveloper.org/news/17802</guid>
      <link>http://www.phpdeveloper.org/news/17802</link>
      <description><![CDATA[<p>
On the BinaryTides blog there's a <a href="http://www.binarytides.com/blog/tag/php-advanced-techniques/">series of posts</a> that share some tips and suggestions aimed at helping you and your code be the best they can be - things to enhance your application (including suggestions not just about code but also about environment and development practices).
</p>
<p>
The <a href="http://www.binarytides.com/blog/35-techniques-to-enhance-your-php-code/">three</a> <a href="http://www.binarytides.com/blog/40-techniques-to-enhance-your-php-code-part-2/">posts</a> <a href="http://www.binarytides.com/blog/40-techniques-to-enhance-your-php-code-part-3/">in the series</a> include tips like:
</p>
<ul>
<lI>Maintain debugging environment in your application
<li>Collect all output at one place , and output at one shot to the browser
<li>Set the correct character encoding for a mysql connection
<li>Do not gzip output in your application , make apache do that
<li>Don't check submit button value to check form submission
<li>Process arrays quickly with array_map
<li>Avoid direct SQL query , abstract it
<li>Never set error_reporting to 0
<li>Make a portable function for executing shell commands
</ul>
<p>
Obviously, not all of these will apply in all situations, but they're an interesting list. Most will come with good explanations and code samples when appropriate.
</p>]]></description>
      <pubDate>Wed, 11 Apr 2012 09:52:57 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Lars Tesmer's Blog: What My Co-Workers and I Learned When Trying to Write Unit Tests for PHPUnit]]></title>
      <guid>http://www.phpdeveloper.org/news/16839</guid>
      <link>http://www.phpdeveloper.org/news/16839</link>
      <description><![CDATA[<p>
<i>Lars Tesmer</i> and his coworkers have been working on improving their development skills lately, specifically <a href="http://lars-tesmer.com/blog/2011/09/08/what-my-co---workers-and-i-learned-when-trying-to-write-unit-tests-for-phpunit/">related to unit testing</a>. In his latest post he shares some of what they've discovered along the way.
</p>
<blockquote>
The plan was to try and write as many tests as we could for the <a href="https://github.com/sebastianbergmann/phpunit/tree/master/PHPUnit/Framework/Constraint">Constraint classes</a> PHPUnit uses to implement its assertions. [...] Well, our plan didn't work out that way, we didn't really succeed in writing a considerable amount of unit tests. However, it still was a valuable experience, as it turned out the unit tests of the Constraints are a good example of how not to unit test.
</blockquote>
<p>
He includes three of the major points they came across in their practice development:
</p>
<ul>
<li>Don't use one single test case class to test several different classes
<li>Name your tests well
<li>Avoid to test more than one behaviour in one single test
</ul>
<p>
For each, there's a summary answering the "why" question behind them including an example test (testConstraintIsType) that shows a bad, multiple assertion practice that should be avoided if possible.
</p>]]></description>
      <pubDate>Fri, 09 Sep 2011 11:56:04 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Reddit.com: What are the most popular (or best) methods to translate a PHP-built website?]]></title>
      <guid>http://www.phpdeveloper.org/news/15657</guid>
      <link>http://www.phpdeveloper.org/news/15657</link>
      <description><![CDATA[<p>
In <a href="http://www.reddit.com/r/PHP/comments/etd8d/what_are_the_most_popular_or_best_methods_to/">this new post</a> from Reddit.com a question is asked about website translations and the opinions on best practices for it.
</p>
<blockquote>
I'm just curious what the best practices are for translating your website into another language, to present foreign readers with text in their home lingua -- well, particularly if there are PHP-specific methods to do so. I've stumbled across the pages for GNU gettext and that seems interesting, but I'm curious what people think of it.
</blockquote>
<p>
Suggestions include manual translation via a human, use a text substitution method two swap out content versions based on language, using language files (and some opinions from others on which of these approaches might work best).
</p>]]></description>
      <pubDate>Thu, 30 Dec 2010 10:42:28 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Lorna Mitchell' Blog: Best Practices in API Design: Audio and Slides]]></title>
      <guid>http://www.phpdeveloper.org/news/15288</guid>
      <link>http://www.phpdeveloper.org/news/15288</link>
      <description><![CDATA[<p>
<i>Lorna Mitchell</i> has new post today <a href="http://www.lornajane.net/posts/2010/Best-Practices-in-API-Design-Audio-and-Slides">pointing out the release</a> of both the slides and the audio from a presentation she gave at the <a href="http://phpconference.co.uk/">PHP UK conference</a> (back in February of this year) about some of the best practices in API design and development.
</p>
<blockquote>
I really enjoyed giving this talk, since I work so much with APIs and enjoy sharing my ideas. The <a href="http://phpconference.co.uk/uploads/talks/2010/BestPracticesInWebServiceDesign_LornaMitchell.mp3">audio is now online</a> so if you missed the talk, feel free to have a listen. You can also see the <a href="http://www.slideshare.net/lornajane/best-practices-in-web-service-design">slides (on slideshare)</a> and also read the <a href="http://www.lornajane.net/plugin/tag/apidesign">series of blog posts</a> I wrote on this topic which originally inspired the talk. 
</blockquote>
<p>
<i>Lorna</i> has also posted slides for several other of her web services talks including <a href="http://www.slideshare.net/lornajane/working-with-webservices-5031166">Working with Web Services</a>, <a href="http://www.slideshare.net/lornajane/php-and-web-services-perfect-partners">PHP and Web Services</a> and <a href="http://www.slideshare.net/lornajane/architecting-web-services">Archtecting Web Service Applications</a>.
</p>]]></description>
      <pubDate>Fri, 15 Oct 2010 11:42:51 -0500</pubDate>
    </item>
  </channel>
</rss>
