<?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, 21 May 2013 21:57:02 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[MaltBlue.com: Zend Framework 2 - Hydrators, Models and the TableGateway Pattern]]></title>
      <guid>http://www.phpdeveloper.org/news/19589</guid>
      <link>http://www.phpdeveloper.org/news/19589</link>
      <description><![CDATA[<p>
<i>Matthew Setter</i> has written up a post to his site that continues his look at the features of Zend Framework 2. This time he's looking specifically at <a href="http://www.maltblue.com/tutorial/zendframework2-hydrators-models-tablegateway-pattern">hydrators, models and the table gateways</a> and their use in connecting your application with a database.
</p>
<blockquote>
One set of features has really been helping me of late ones that really have me smiling; these are: Hydrators, Models and Table Gateways. If you're new to ZF2 or database interaction with frameworks, then you're in a perfect position as today's post will be giving you a good introduction to the basics of using both together.
</blockquote>
<p>
He starts with a look back at how it all was done in ZF1 and shows how using these three components makes for an even better system, allowing the model to be completely data-source agnostic. His examples start with the table gateway class, showing how to connect it with a "users" table. From there he adds in the model (with an "exchangeArray" method) and a hydrator that maps the table columns to the properties on the entity. He shows how to add this setup to the service configuration and its use in a controller, returning a full list of the records in the "user" table.
</p>
Link: http://www.maltblue.com/tutorial/zendframework2-hydrators-models-tablegateway-pattern]]></description>
      <pubDate>Wed, 15 May 2013 11:13:46 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Chris Jones: Getting Started with PHP Zend Framework 2 for Oracle DB]]></title>
      <guid>http://www.phpdeveloper.org/news/19588</guid>
      <link>http://www.phpdeveloper.org/news/19588</link>
      <description><![CDATA[<p>
In his <a href="https://blogs.oracle.com/opal/entry/getting_started_with_php_zend">latest post</a> to his site <i>Chris Jones</i> shows you how to update the <a href="http://zf2.readthedocs.org/en/latest/user-guide/overview.html">Zend Framework 2 tutorial app</a> (quickstart) to make it work with an Oracle database instead.
</p>
<blockquote>
This post shows the changes to the <a href="http://zf2.readthedocs.org/en/latest/user-guide/overview.html">ZF2 tutorial application</a> to allow it to run with Oracle Database 11gR2. [...] The instructions for creating the sample ZF2 application are <a href="http://zf2.readthedocs.org/en/latest/user-guide/overview.html">here</a>. Follow those steps as written, making the substitutions shown [in the rest of the post].
</blockquote>
<p>
The full schema definition is included in the post, complete with the same sample data as the tutorial. He includes the updates you'll need to make to the database configuration for the OCI8 connection and changes to the code to accommodate the Oracle data format (mostly uppercasing everything). 
</p>
Link: https://blogs.oracle.com/opal/entry/getting_started_with_php_zend]]></description>
      <pubDate>Wed, 15 May 2013 10:55:41 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Reddit.com: Zend2 vs Symfony2]]></title>
      <guid>http://www.phpdeveloper.org/news/19544</guid>
      <link>http://www.phpdeveloper.org/news/19544</link>
      <description><![CDATA[<p>
On Reddit.com there's <a href="http://www.reddit.com/r/PHP/comments/1dcqst/zend2_vs_symfony2/">a discussion happening</a> comparing two popular and prominent PHP frameworks - Zend Framework 2 and Symfony 2.
</p>
<blockquote>
For those that have used both frameworks, what one do you feel is a better overall framework? I tried ZF2 in beta and it seemed overly complicated to symfony but I don't know if its gotten better since then.
</blockquote>
<p>Opinions shared in the comments of the post include things like:</p>
<ul>
<li>"So if you are learning for job prospects, go Zend. I love Symfony 2 though, its a joy to work with."
<li>"It doesn't matter. Each has a strength and a weakness, and neither will go away. Pick one and use it, you'll be fine."
<li>"I don't think there is such thing as a best framework as you should use the best tool for the job. I don't think MVC is the solution to all problems."
<li>"Both are quite bloated but they have to be considering their target markets."
</ul>
<p>
On the whole, the views are of the "best tool for the job" mentality - a good sign for the community and these two frameworks.
</p>
Link: http://www.reddit.com/r/PHP/comments/1dcqst/zend2_vs_symfony2]]></description>
      <pubDate>Fri, 03 May 2013 12:57:56 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[MaltBlue.com: Use RouteMatch in Zend Framework 2 For Easy Routing]]></title>
      <guid>http://www.phpdeveloper.org/news/19536</guid>
      <link>http://www.phpdeveloper.org/news/19536</link>
      <description><![CDATA[<p>
In the latest to his site <i>Matthew Setter</i> takes a look at <a href="http://www.maltblue.com/tutorial/use-zend-framework-2-routematch-for-dynamic-routing">easy routing with RouteMatch</a> in Zend Framework 2 applications. The <a href="http://framework.zend.com/apidoc/2.0/classes/Zend.Mvc.Router.Http.RouteMatch.html">RouteMatch</a> component gives you better control over your routing and lets you define "match paths" for URL to Controller mappings.
</p>
<blockquote>
Today using Zend Framework 2 RouteMatch, Router and Request objects, I show you an easy way to dynamically update the current route. It's almost painlessly simple. [...] Well, like most things in web application development, what starts out simply in the beginner often grows more complex over time. So too is my once simple route.
</blockquote>
<p>
His "simple" route started getting a bit out of control when he added in some pagination to the page (and query for the path match). He wanted to figure out how to re-render data with the same filters but show the next page of data. He shows how to use the RouteMatch component to achieve just this. He creates a custom module with a "listViewToolbar" helper that lets you read the router, request and handle the parameters sent via the URL. The "invoke" method is called to render the toolbar in the page, complete with the new settings.
</p>
Link: http://www.maltblue.com/tutorial/use-zend-framework-2-routematch-for-dynamic-routing]]></description>
      <pubDate>Thu, 02 May 2013 11:14:22 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Rob Allen: Injecting configuration into a ZF2 controller]]></title>
      <guid>http://www.phpdeveloper.org/news/19524</guid>
      <link>http://www.phpdeveloper.org/news/19524</link>
      <description><![CDATA[<p>
<i>Rob Allen</i> has a a new post to his site today showing you how to <a href="http://akrabat.com/zend-framework-2/injecting-configuration-into-a-zf2-controller/">inject configuration information</a> into a Zend Framework 2 controller via an interface and some initializer settings in the module setup.
</p>
<blockquote>
One thing you may find yourself needing to do is access configuration information in a controller or service class. The easiest way to do this is to use the ServiceManger's initialiser feature. This allows you to write one piece of injection code that can be applied to multiple objects. It's easier to show this in action!
</blockquote>
<p>
He includes a sample configuration file (with a setting for "setting_1") and the interface you implement to structure the load request. He then shows how to hook this into the controller and the code needed for the module "getControllerConfig" (or "getServiceConfig" for use with services) to load in the file and set it to the correct object.
</p>
Link: http://akrabat.com/zend-framework-2/injecting-configuration-into-a-zf2-controller]]></description>
      <pubDate>Tue, 30 Apr 2013 09:11:16 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Reddit.com: Dependency injection in ZF2 and Symfony 2 are service locators]]></title>
      <guid>http://www.phpdeveloper.org/news/19468</guid>
      <link>http://www.phpdeveloper.org/news/19468</link>
      <description><![CDATA[<p>
On Reddit's PHP section there's a discussion happening about <a href="http://www.reddit.com/r/PHP/comments/1caidn/dependency_injection_in_zf2_and_symfony_2_are/"> dependency injection versus service locators</a> in two popular PHP frameworks - Zend Framework 2 and Symfony 2 (and how they're not really DI at all).
</p>
<blockquote>
Both ZF2 and Symfony 2 offer the same behavior: if I'm in a controller, and I want to use a service, I have to get it from the container with $this->get('my_service').
As such, the controller is not using DI, this is the service locator pattern. Controllers become more difficult to tests because of that, and they depend on the container now. I wonder why both frameworks didn't go further: why not treat controllers like services and use dependency injection on them. In other words: if a controller needs a service "A", then it should get it in the constructor, or through setter/property injection.
</blockquote>
<p>
The <a href="http://www.reddit.com/r/PHP/comments/1caidn/dependency_injection_in_zf2_and_symfony_2_are/">comments</a> talk some about the "controller from the DI container" idea, some other ways around the problem and some clarification as to what the frameworks are actually doing related to the container injection.
</p>
Link: http://www.reddit.com/r/PHP/comments/1caidn/dependency_injection_in_zf2_and_symfony_2_are]]></description>
      <pubDate>Tue, 16 Apr 2013 12:40:07 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[MaltBlue.com: Zend Framework 2 Forms - Simple and Available Everywhere]]></title>
      <guid>http://www.phpdeveloper.org/news/19411</guid>
      <link>http://www.phpdeveloper.org/news/19411</link>
      <description><![CDATA[<p>
<i>Matt Setter</i> has a new post to his site today about <a href="http://www.maltblue.com/zend-framework/simple-zend-framework-2-forms">forms in Zend Framework 2</a> including a full example on how to use them to create a form for user information (first name, last name).
</p>
<blockquote>
I think it goes without saying, forms are one of the central elements of any web-based application. They're used for everything from logging in, to searching content and managing information. Given that, they should be first-class citizens, able to be developed and reused with relative ease. [...] However, given the amount of options, configurability and flexibility required, this isn't always easy. [...] In today's post, I'm going to assume you have a basic understanding of how forms work now. [...] I'm going to show you how to create flexible, reusable forms in one module and by the power of the ServiceManager reuse them throughout your application. 
</blockquote>
<p>
He starts with the inclusion of a dependency needed for his example - the ZfcUser component (installed via Composer). He then moves on to the actual code for the form creating a reusable module, an entity class for the User and the Fieldset/Form classes for the contents of the form. He also includes the code for the controller action and the view that outputs the form itself and handles the repopulation automagically (and includes a CSRF token).
</p>
Link: http://www.maltblue.com/zend-framework/simple-zend-framework-2-forms]]></description>
      <pubDate>Thu, 04 Apr 2013 11:29:49 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Matthew Weier O'Phinney: RESTful APIs with ZF2, Part 3]]></title>
      <guid>http://www.phpdeveloper.org/news/19234</guid>
      <link>http://www.phpdeveloper.org/news/19234</link>
      <description><![CDATA[<p>
<i>Matthew Weier O'Phinney</i> has posted the <a href="http://mwop.net/blog/2013-02-25-restful-apis-with-zf2-part-3.html">third part of his series</a> about making RESTful APIs with Zend Framework 2 (parts <a href="http://phpdeveloper.org/news/19170">one</a> and <a href="http://phpdeveloper.org/news/19180">two</a>). In this latest part of the series, he talks more about documenting the API and what commands can be executed.
</p>
<blockquote>
In this post, I'll be covering documenting your API -- techniques you can use to indicate what HTTP operations are allowed, as well as convey the full documentation on what endpoints are available, what they accept, and what you can expect them to return. [...] hy Document? If you're asking this question, you've either never consumed software, or your software is perfect and self-documenting. I frankly don't believe either one.
</blockquote>
<p>
He covers a few reasons why you should document your API and where he thinks it should live to be the most useful. He includes a few different ideas and two things he definitely thinks should exist for your API - the use of OPTIONS and end-user documentation. The first is a HTTP header (ZF2 code example included) that tells the API consumer what they can do with an endpoint. The second type is more useful for the human reader, giving them a better overall perspective on what the API can do - still served through the API but in a bit more understandable format.
</p>]]></description>
      <pubDate>Mon, 25 Feb 2013 12:21:30 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Jason Fox: Use the Accept Header to Set Your Return Data With Zend Framework 2]]></title>
      <guid>http://www.phpdeveloper.org/news/19222</guid>
      <link>http://www.phpdeveloper.org/news/19222</link>
      <description><![CDATA[<p>
<i>Jason Fox</i> has a recent post to his site about using <a href="http://neverstopbuilding.net/use-the-accept-header-to-set-your-return-data-with-zend-framework-2/?utm_source=reddit">"Accept" headers in Zend Framework 2 apps</a> to set the format of the return data from a request.
</p>
<blockquote>
In this article I detail the process by which you can set up your controller actions in Zend Framework 2 to return either the default HTML, or JSON data depending on the "Accept Header" in the request. It incorporates changes related to a security update added since this <a href="http://akrabat.com/zend-framework-2/returning-json-using-the-accept-header-in-zf2/">very helpful article</a> was written, and expands on some of the intricacies of making your web layer objects better "json providers."
</blockquote>
<p>
His example uses a "ViewJsonStrategy" and the criteria to look for to determine which version to respond with (HTML or JSON) - the Accept header. It uses the JSON encoder/decoder instead of the built-in PHP one to he could use the included "toJson" method to customize the output of the JSON instead of just returning everything.
</p>]]></description>
      <pubDate>Fri, 22 Feb 2013 11:42:35 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Matthew Weier O'Phinney: RESTful APIs with ZF2, Part 2]]></title>
      <guid>http://www.phpdeveloper.org/news/19180</guid>
      <link>http://www.phpdeveloper.org/news/19180</link>
      <description><![CDATA[<p>
<i>Matthew Weier O'Phinney</i> has posted the <a href="http://www.mwop.net/blog/2013-02-13-restful-apis-with-zf2-part-2.html">second part of his series</a> looking at creating RESTful APIs with the Zend Framework v2. In the <a href="http://phpdeveloper.org/news/19170">previous post</a> he covered some of the basics of data and structure. In this new article he looks at content types, status codes and two ways to represent them back to your users.
</p>
<blockquote>
In my <a href="http://www.mwop.net/blog/2013-02-11-restful-apis-with-zf2-part-1.html">last post</a>, I covered some background on REST and the Richardson Maturity Model, and some emerging standards around hypermedia APIs in JSON; in particular, I outlined aspects of Hypermedia Application Language (HAL), and how it can be used to define a generic structure for JSON resources. In this post, I cover an aspect of RESTful APIs that's often overlooked: reporting problems.
</blockquote>
<p>
He starts with some of the things around error handling and APIs that bother him and why just returning a status code representing an error isn't enough. He suggests two possible solutions to this issue - two messaging formats, API-Problem and vnd.error. He gives brief summaries of each and includes example output to give them some context.
</p>]]></description>
      <pubDate>Thu, 14 Feb 2013 09:15:06 -0600</pubDate>
    </item>
  </channel>
</rss>
