<?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 12:06:51 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Rob Allen: Objects in the model layer]]></title>
      <guid>http://www.phpdeveloper.org/news/19350</guid>
      <link>http://www.phpdeveloper.org/news/19350</link>
      <description><![CDATA[<p>
In <a href="http://akrabat.com/development/objects-in-the-model-layer/">this latest post</a> to his site <i>Rob Allen</i> talks some about application structure and the different kinds of objects he uses in his applications.
</p>
<blockquote>
I currently use a very simple set of core objects within my model layer: entities, mappers and service objects. [...] I dislike the phrase "service object" as the word "service" means so many things to so many people. I haven't heard a better phrase yet that everyone understands though.
</blockquote>
<p>
He defines each of the types of objects to help make the separation clearer. Here they are in brief:
</p>
<ul>
<li>Entities are objects that represent something in my business logic.
<li>Mappers know how to save and load an entity from the data store.
<li>Service objects provide the API that the rest of the application uses.
</ul>
<p>
Some of the comments on the post relate his choices to use in Zend Framework v2-based applications, noting that there are some base components you can extend to create these kinds of objects.
</p>]]></description>
      <pubDate>Fri, 22 Mar 2013 10:45:54 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Vinícius Krolow: Some tips to improve your codes readability]]></title>
      <guid>http://www.phpdeveloper.org/news/19090</guid>
      <link>http://www.phpdeveloper.org/news/19090</link>
      <description><![CDATA[<p>
In <a href="http://cobaia.net/php/2013/01/20/some-tips-to-improve-your-codes-readability/">this new post</a> to his site <i>Vinícius Krolow</i> shares some tips he thinks will help to make your PHP code more readable in the long run.
</p>
<blockquote>
What about code readability, from my point of view is one of the most important thing in the code. Who writes code that is easy to read, writes good code. Probably reading code is where you spent most part of your time, and not only your code, probably code of your team mates, or maybe code from the open source community, so write code that is simple and is easy to understand it's really important.
</blockquote>
<p>His tips (seven of them) are:</p>
<ul>
<li>Comment before write your code (DocBlock)
<li>Return frequently, Return early
<li>Break, Continue
<li>Code Standard / Name conventions
<li>Throw Exception
<li>Comment often, but not write stupid comments
<li>Methods can be always smaller than they are
</ul>
<p>
It's a little difficult to read as the English isn't the speaker's native tongue, but it gets the point across. He also recommends <a href="http://www.bennadel.com/resources/uploads/2012/ObjectCalisthenics.pdf">reading this</a> if you'd like more information about writing better OOP code that's easier to read.
</p>]]></description>
      <pubDate>Fri, 25 Jan 2013 09:53:55 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Rob Allen: Thoughts on module directory structure]]></title>
      <guid>http://www.phpdeveloper.org/news/18991</guid>
      <link>http://www.phpdeveloper.org/news/18991</link>
      <description><![CDATA[<p>
<i>Rob Allen</i>, in his Zend Framework 2 development, has <a href="http://akrabat.com/zend-framework-2/thoughts-on-module-directory-structure/">come up with a list of suggestions</a> about the use of modules in your applications, mainly relating to the structure of the files inside of them.
</p>
<blockquote>
I've been working on a Zend Framework 2 module within a larger project that doesn't have that many PHP class files. Specifically, it has a controller, a mapper, an entity, a service and a form. As a result, the traditional Zend Framework 2 directory structure for the Account module looks [overly complicated]. That's a lot of directories for not many files! As a result, I decided to flatten it to [something simpler].
</blockquote>
<p>
He includes both the "before" and "after" directory structures and continues on with two more suggestions - the removal of the top level "Account" folder inside of "src/" and, finally, removing "src/" all together with a slight modification to the autoloading. With a simpler module, though, something like this might make it easier to maintain and "follow" later down the road.
</p>]]></description>
      <pubDate>Fri, 04 Jan 2013 09:09:55 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Web & PHP Magazine: Issue #8 - The Power of Design]]></title>
      <guid>http://www.phpdeveloper.org/news/18755</guid>
      <link>http://www.phpdeveloper.org/news/18755</link>
      <description><![CDATA[<p>
The latest issue of the Web & PHP Magazine has been released - <a href="http://webandphp.com/issue-8">Issue 8 - The Power of Design</a>. Articles in this latest issue include:
</p>
<ul>
<li><i>Todd Lombardo</i> on user context
<li><i>Stefan Priebsch</i> on data and persistence
<li><i>Patrick Allaert</i> about data structures
<lI><i>June Henriksen</i> on the human side of programming
</ul>
<p>
You can find out more about this issue (and go download your free copy) <a href="http://webandphp.com/issue-8">on the Web & PHP site</a>. There's also seven previous issues, all free for download (PDF format)!
</p>]]></description>
      <pubDate>Thu, 15 Nov 2012 13:55:06 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Josh Adell: Interfaces and Traits: A Powerful Combo]]></title>
      <guid>http://www.phpdeveloper.org/news/18530</guid>
      <link>http://www.phpdeveloper.org/news/18530</link>
      <description><![CDATA[<p>
<i>Josh Adell</i> has a new post today looking at the "powerful combination" of using traits and interfaces in PHP applications. He shows how, despite traits not implementing the interface directly, they can <a href="http://blog.everymansoftware.com/2012/09/interfaces-and-traits-powerful-combo.html">be used to make other classes adhere to them</a> simply by "using" them.
</p>
<blockquote>
If you're not using <a href="http://php.net/manual/en/language.oop5.interfaces.php">interfaces</a> in PHP, you are missing out on a powerful object-oriented programming feature. An interface defines how to interact with a class. By defining an interface and then implementing it, you can guarantee a "contract" for consumers of a class. Interfaces can be used across unrelated classes. And they become even more useful when combined with the new <a href="http://php.net/manual/en/language.oop5.traits.php">traits</a> feature in PHP 5.4.
</blockquote>
<p>
He illustrates with a package shipping example and uses an "Addressable" Interface to define the structure for both a Company and Users class. He includes code showing how to implement it in a more traditional "implements" way in a class, but also shows an interesting way to achieve the same thing with traits. Having a trait that follows the interface makes it easy to have a class adhere to the interface just by including the trait (or "using" it).
</p>]]></description>
      <pubDate>Fri, 28 Sep 2012 08:51:16 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Danne Lundqvist's Blog: Getting to grips with an existing XML structure]]></title>
      <guid>http://www.phpdeveloper.org/news/17864</guid>
      <link>http://www.phpdeveloper.org/news/17864</link>
      <description><![CDATA[<p>
<i>Danne Lundqvist</i> has a new post where he shares a bit of code he's written to "come to grips" with <a href="http://www.dotvoid.com/2012/04/getting-to-grips-with-an-existing-xml-structure/">an existing XML structure</a>.
</p>
<blockquote>
Very often I find myself writing input filters for large XML files using PHP. Common enough task; and PHP offer a great variety of tools to do this effectively depending on the situation. Unfortunately, almost as common is the lack of documentation for the aforementioned XML files. [...] I have looked around for a simple tool but I didn't really find a  tool that gave me the quick and dirty overview I wanted. A year or so ago I finally wrote a small PHP class to analyze large XML files.
</blockquote>
<p>
He includes an example XML file, the <a href="http://www.dotvoid.com/wp-content/uploads/2012/04/xmlstruct.png">HTML output</a> of the parsing and a sample of how to use <a href="http://www.dotvoid.com/wp-content/uploads/2012/04/xmlgrips.tar.gz">the class</a> to parse and output the XML structure, complete with some CSS.
</p>]]></description>
      <pubDate>Wed, 25 Apr 2012 10:44:43 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Sameer Borate's Blog: Building a Graph data structure in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17543</guid>
      <link>http://www.phpdeveloper.org/news/17543</link>
      <description><![CDATA[<p>
In the <a href="http://www.codediesel.com/algorithms/building-a-graph-data-structure-in-php">latest post</a> to his blog <i>Sameer Borate</i> takes a look at using the <a href="http://pear.php.net/package/Structures_Graph/download">Structures_Graph</a> package from PEAR to create data structures in PHP with linked nodes for directed and undirected graphs.
</p>
<blockquote>
The Pear Structures_Graph package allows creating and manipulating graph data structures. It allows building of either directed or undirected graphs, with data and metadata stored in nodes. The library provides functions for graph traversing as well as for characteristic extraction from the graph topology.
</blockquote>
<p>
After sharing the one-line install, he shows how to create some instances of the package's Nodes and how to connect them to a graph and link them to other nodes. He includes a few examples - a simpler one with multiple nodes joined in a directed graph, another showing how to associate data with a node and how to query the graph for node connections and testing to see if the graph is <a href="http://en.wikipedia.org/wiki/Directed_acyclic_graph">acyclic</a>.
</p>]]></description>
      <pubDate>Wed, 15 Feb 2012 09:35:15 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Larry Garfield's Blog: PHP project structure survey]]></title>
      <guid>http://www.phpdeveloper.org/news/17401</guid>
      <link>http://www.phpdeveloper.org/news/17401</link>
      <description><![CDATA[<p>
<i>Larry Garfield</i> has posted the results of some of his research into popular PHP frameworks and projects and <a href="http://www.garfieldtech.com/blog/php-project-structure">see how they handle their structure</a> as it relates to the PSR-0 standard.
</p>
<blockquote>
As <a href="http://drupal.org/">Drupal</a> is in the process of considering how to restructure code to best leverage the PSR-0 standard, I figured it would be wise to take a quick survey of how some other major projects organize their code bases. This is not a complete rundown of every project, simply roughly comparable notes for those areas Drupal is currently discussing. I am posting it here in the hopes that it will be useful to more than just Drupal.
</blockquote>
<p>The projects he looked to for his examples were:</p>
<ul>
<li><a href="http://cakephp.org/">CakePHP</a>
<li><a href="http://symfony.com/">Symfony2</a>
<li><a href="http://silex.sensiolabs.org/">Silex</a>
<li><a href="http://codeigniter.com/">CodeIgniter</a>
<li><a href="https://github.com/zendframework/zf2">Zend Framework 2</a>
<li><a href="http://packagist.org/">Composer</a>
</ul>]]></description>
      <pubDate>Mon, 16 Jan 2012 13:08:38 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[XpertDeveloper.com: Abstract in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17055</guid>
      <link>http://www.phpdeveloper.org/news/17055</link>
      <description><![CDATA[<p>
On the XpertDeveloper.com site today there's a new tutorial talking about something that can not only help the structure of your application but can make things more reusable in the end - <a href="http://www.xpertdeveloper.com/2011/10/abstract-in-php/">abstract classes</a>.
</p>
<blockquote>
For Abstact keyword we can say that, abstract is type of the class and class which we can't create a object of it. Surprised???? [...] Abstract class can be used some what like an interface in PHP. So basically we can implement class using abstract. We can't extend more than one abstract class while we can implement more than one interface.
</blockquote>
<p>
They introduce you to the creation of an abstract class and show how to set up some abstract methods inside. These methods are required to be defined as a part of the extension in your class. One of the benefits they don't mention of abstract classes over interfaces is the ability to have methods in the abstract that are actual code, not just definitions of the structure (that's more of what <a href="http://us.php.net/interfaces">interfaces</a> are for).
</p>]]></description>
      <pubDate>Fri, 28 Oct 2011 09:55:07 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Stuart Herbert's Blog: PHP Components: Shipping Web Pages With Your Components]]></title>
      <guid>http://www.phpdeveloper.org/news/16726</guid>
      <link>http://www.phpdeveloper.org/news/16726</link>
      <description><![CDATA[<p>
<i>Stuart Herbert</i>'s latest post in his "PHP Components" series looks at an optional but handy thing you can include in your component's package - web pages (be they a manual or other kind of information). <a href="http://blog.stuartherbert.com/php/2011/08/16/php-components-shipping-web-pages-with-your-components/">This new post</a> talks about where they should lie in the component's package structure.
</p>
<blockquote>
I'm now going under the bonnet of our components, and looking at the different <a href="http://blog.stuartherbert.com/php/2011/04/04/explaining-file-roles/">file roles</a> that the PEAR installer expects to find when we distribute our component as a PEAR-compatible package. It isn't very often that a component needs to ship web pages too, but should the need arise, here's how to do it.
</blockquote>
<p>
He starts by defining what a "web page" could be (HTML, Javascript, CSS, etc) and gives <a href="http://blog.stuartherbert.com/php/wp-content/uploads/2011/08/php-www-role-11.png">the place in the hierarchy</a> they should fit. When you use the PEAR client to install the package, these files are placed in the "www" folder of your PEAR installation.
</p>]]></description>
      <pubDate>Tue, 16 Aug 2011 13:13:06 -0500</pubDate>
    </item>
  </channel>
</rss>
