<?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>Tue, 22 May 2012 13:11:53 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPMaster.com: PHP Security: Cross-Site Scripting Attacks (XSS)]]></title>
      <guid>http://www.phpdeveloper.org/news/17890</guid>
      <link>http://www.phpdeveloper.org/news/17890</link>
      <description><![CDATA[<p>
PHPMaster.com has a new tutorial posted today (by <i>George Fekete</i>) about <a href="http://phpmaster.com/php-security-cross-site-scripting-attacks-xss/">preventing cross-site scripting attacks</a> in your PHP-based applications.
</p>
<blockquote>
Unfortunately, cross-site scripting attacks occurs mostly, because developers are failing to deliver secure code. Every PHP programmer has the responsibility to understand how attacks can be carried out against their PHP scripts to exploit possible security vulnerabilities. Reading this article, you'll find out more about cross-site scripting attacks and how to prevent them in your code.
</blockquote>
<p>
Included in the tutorial is an example with a simple form and definitions of different types of XSS attacks - reflected XSS, persistent XSS and three ways to prevent them: data filtering, output filtering and data validation. He also links to a few "cheatsheets" to help even more (including <a href="http://ha.ckers.org/xss.html">this guide</a> and a Zend Framework set of <a href="http://www.zfsnippets.com/snippets/view/id/5">XSS test data</a>.
</p>]]></description>
      <pubDate>Tue, 01 May 2012 11:59:28 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Kevin Schroeder's Blog: ZF2 Dependency Injection: Managing Configuration - Part 2]]></title>
      <guid>http://www.phpdeveloper.org/news/17874</guid>
      <link>http://www.phpdeveloper.org/news/17874</link>
      <description><![CDATA[<p>
<i>Kevin Schroeder</i> has posted the <a href="http://www.eschrade.com/page/zf2-dependency-injection-managing-configuration-part-2/">second part of his ZF2 dependency injection</a> series (part one <a href="http://phpdeveloper.org/news/17868">here</a>) talking about their configuration.
</p>
<blockquote>
In my <a href="http://www.eschrade.com/page/zf2-dependency-injection-managing-configuration/">previous post about Dependency Injection Container (DiC) configuration</a> I made mention of some more complicated scenarios that you can use to configure your objects.  Not that you need help to make it  more complicated. [...] That's why I think this series of blog posts are good.  They show you how to get started small which is really the only way to get started if you aren't intimately familiar with a DiC.
</blockquote>
<p>
He expands on the previous example by adding another method that lets you set up some testing data (injected into the Test class object) and feed in the data via the "parameters" DI container configuration.
</p>]]></description>
      <pubDate>Fri, 27 Apr 2012 08:20:49 -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[Rob Allen's Blog: Returning JSON from a ZF2 controller action]]></title>
      <guid>http://www.phpdeveloper.org/news/17748</guid>
      <link>http://www.phpdeveloper.org/news/17748</link>
      <description><![CDATA[<p>
In a new post to his blog <i>Rob Allen</i> shows how you can return JSON data <a href="http://akrabat.com/zend-framework-2/returning-json-from-a-zf2-controller-action/">directly back from a controller</a> in a Zend Framework 2 application.
</p>
<blockquote>
The new view layer in Zend Framework 2 can be set up to return JSON rather than rendered HTML relatively easily. [...] Firstly we need to set up the view's JsonStrategy to check to a situation when returning JSON is required and then to render out JSON for us.
</blockquote>
<p>
This "JsonStrategy" does some of the hard work for you - detecting when the client is requesting a JSON response and looking at the data coming into the view to see if it's JSON. He shows how to implement it in a sample module using the "onBootstrap" module and how to force a return of the JsonModel even when JSON isn't requested (useful for a consistent interface).
</p>]]></description>
      <pubDate>Thu, 29 Mar 2012 08:55:39 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Building a Domain Model - Integrating Data Mappers]]></title>
      <guid>http://www.phpdeveloper.org/news/17691</guid>
      <link>http://www.phpdeveloper.org/news/17691</link>
      <description><![CDATA[<p>
In <a href="http://phpdeveloper.org/news/17591">this previous post</a> PHPMaster.com introduced you to the concept of "domain models", structures defining how data should be formatted for consistency. In <a href="http://phpmaster.com/integrating-the-data-mappers/">this second part</a> of the series, <i>Alejandro</i> show show to integrate them with a data access layer (DAL) to make them easier to work with.
</p>
<blockquote>
The phrase may sound like an cheap clich&eacute;, I know, but I'm not particularly interested in reinventing the wheel each time I tackle a software problem (unless I need a nicer and faster wheel, of course). In this case, the situation does warrant some additional effort considering we'll be trying to connect a batch of mapping classes to a blog's domain model. Given the magnitude of the endeavor, the idea is to set up from scratch a basic Data Access Layer (DAL) so that domain objects can easily be persisted in a MySQL database, and in turn, retrieved on request through some generic finders.
</blockquote>
<p>
He includes all the code you'll need to create a (namespaced) database adapter (PDO), the mapping layer to tie the domain models together and using it all in a practical "blog" example with posts, comments and users.
</p>]]></description>
      <pubDate>Mon, 19 Mar 2012 11:27:26 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Brandon Savage's Blog: REST APIs as Data Backends]]></title>
      <guid>http://www.phpdeveloper.org/news/17689</guid>
      <link>http://www.phpdeveloper.org/news/17689</link>
      <description><![CDATA[<p>
In his most recent post <i>Brandon Savage</i> looks at a practice that's becoming more and more common - <a href="http://www.brandonsavage.net/rest-apis-as-data-backends/">using a REST API as a data source</a> for a web-based application.
</p>
<blockquote>
We were faced with an increasing number of data sources, including the coming addition of Elastic Search to the data storage system, and maintenance was becoming a problem. Thus, the decision was made to move our data layer to our REST API exclusively, removing all direct access to data storage from the web interface. This is the second such project I've been on where an external API has been used for the retrieval of all data in an application. It's a novel concept, but one that takes some getting used to to be sure.
</blockquote>
<p>
He talks about some of the advantages of this approach including the ability to be more flexible with the actual technology used to create the API, the ability to write other applications on top of it and a glimpse into some of the process that's been going on as a part of the project.
</p>]]></description>
      <pubDate>Mon, 19 Mar 2012 09:57:14 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Michael Nitschinger's Blog: RFC: li3_fixtures Rewrite]]></title>
      <guid>http://www.phpdeveloper.org/news/17588</guid>
      <link>http://www.phpdeveloper.org/news/17588</link>
      <description><![CDATA[<p>
<i>Michael Nitchinger</i> has a new post to his blog about <a href="http://nitschinger.at/RFC-li3_fixtures-Rewrite">a rewrite for the Lithium framework</a> - changing up the li3_fixtures plugin to make it a bit more of what the community needs.
</p>
<blockquote>
The <a href="https://github.com/daschl/li3_fixtures">li3_fixtures</a> plugin was my first Lithium plugin ever, and while it works okay, I feel there is a lot I can do to make it better and more flexible. In this post I want to share my ideas for a new fixture plugin and also want to gather feedback from the community to make it even more awesome.
</blockquote>
<p>
He gives three instance where fixtures can come in extremely useful - making effective model unit tests with predictable data, mocking models with shortcuts to the data and mocking out web services. Want to add in your own suggestions for his refactor? <a href="http://nitschinger.at/RFC-li3_fixtures-Rewrite">Comment on the post!</a>
</p>]]></description>
      <pubDate>Mon, 27 Feb 2012 09:23:37 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[NetTuts.com: Turbocharge your Website with Memcached]]></title>
      <guid>http://www.phpdeveloper.org/news/17509</guid>
      <link>http://www.phpdeveloper.org/news/17509</link>
      <description><![CDATA[<p>
On the NetTuts.com site there's <a href="http://net.tutsplus.com/tutorials/php/faster-php-mysql-websites-in-minutes/">a new tutorial</a> showing you how to introduce the Memcached tool to your application - a quick and easy way to cache data and optimize performance.
</p>
<blockquote>
Your latest PHP/MySQL website is finally online. And it's awesome. But it's not as fast as you want it to be, because of the many SQL queries running every time a page is generated. And above that, you have the feeling it will not scale well under heavy loads. And you are most likely right. In this tutorial, we will see how you can greatly improve your website's responsiveness [...] by implementing a cache layer between your code and your database. The good news is it is fairly easy, and can be done in a few minutes!
</blockquote>
<p>
They help you get the memcached server installed (a one-liner in most linux distributions) and how to install the memcached extension using <a href="http://pecl.php.net">PECL</a>. Code is included showing you how to connect to the server, store data into the cache based on a generated key and how to pull the same data back out.
</p>]]></description>
      <pubDate>Tue, 07 Feb 2012 10:06:40 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Stuart Herbert's Blog: Introducing ContractLib (Programming Contracts)]]></title>
      <guid>http://www.phpdeveloper.org/news/17394</guid>
      <link>http://www.phpdeveloper.org/news/17394</link>
      <description><![CDATA[<p>
In <a href="http://blog.stuartherbert.com/php/2012/01/11/introducing-contractlib/">this recent post</a> to his blog <i>Stuart Herbert</i> introduces a system he's created to handle "contracts" in PHP development - <a href="https://github.com/stuartherbert/ContractLib">ContractLib</a>.
</p>
<blockquote>
Programming contracts are tests around functions and methods, and they are normally used: to catch any 'bad' data that has been passed into the function or method from the caller, and to catch any 'bad' data generated by the function or method before it can be returned to the caller. These are pre-condition and post-condition tests, and they are tests that either pass or fail.
</blockquote>
<p>
He points out that by having contracts you not only increase the robustness of your code but you also save time not trying to hunt down data-related issues. Using pre-conditions, you can can check data to ensure things like correct formatting, data that's out of range and data that might be missing. His <a href="https://github.com/stuartherbert/ContractLib">ContractLib</a> comes with a set of <a href="https://github.com/stuartherbert/ContractLib/tree/master/src/tests">tests</a> that provide good examples of how to use the functionality. Installation instructions are included.
</p>]]></description>
      <pubDate>Fri, 13 Jan 2012 14:11:52 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Building Concrete Validators]]></title>
      <guid>http://www.phpdeveloper.org/news/17293</guid>
      <link>http://www.phpdeveloper.org/news/17293</link>
      <description><![CDATA[<p>
On DevShed.com today there's the first part of a two-part series showing how to <a href="http://www.devshed.com/c/a/PHP/PHP-Building-Concrete-Validators/">build self-contained validator objects</a> that can be used to test the format of user input for validity.
</p>
<blockquote>
In this two-part tutorial, I show why the use of static helper classes can be detrimental to building robust and scalable object-oriented applications in PHP (though you should take into account that the concept is language agnostic). I also implement a set of instantiable, fine-grained validators, which can be easily tested in isolation, injected into the internals of other objects, and so forth.
</blockquote>
<p>
Their set of "concrete validators" are all based off of a validator interface/abstract class and check things like email formatting, floats, integers and URLs. Also included are a few examples of using the validators in a sample script.
</p>]]></description>
      <pubDate>Thu, 22 Dec 2011 11:24:25 -0600</pubDate>
    </item>
  </channel>
</rss>

