<?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 14:29:55 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPMaster.com: An Introduction to the Front Controller Pattern, Part 1]]></title>
      <guid>http://www.phpdeveloper.org/news/18298</guid>
      <link>http://www.phpdeveloper.org/news/18298</link>
      <description><![CDATA[<p>
If you've done any work with PHP frameworks, the concept of a "front controller" should be a familiar one. If you haven't, the idea might be new to you and PHPMaster.com has started off a series <a href="http://phpmaster.com/front-controller-pattern-1/">that will introduce you to the basics</a> of the Front Controller design pattern in a few different parts.
</p>
<blockquote>
Some are now grumbling about newer concepts that have recently made inroads in day-to-day PHP development, saying Front Controllers are a redundant "reinvention of the wheel" which should be discarded ipso facto. [...] In this two-part article I'll be exploring in depth a couple of straightforward approaches that you might find appealing, especially if you're trying to implement an expandable front controller from scratch without sweating excessively during the process or having to cope with the burdens of a bloated framework.
</blockquote>
<p>
This <a href="http://phpmaster.com/front-controller-pattern-1/">first part</a> of the series introduces you to some of the basic concepts of routing and URL handling and shares the code for a basic front controller. It parses the URL and sets up the controller and action to hand the request off to. Also included is the contents for the .htaccess file you'll need to include to route all requests back through this controller instance.
</p>]]></description>
      <pubDate>Tue, 31 Jul 2012 13:31:12 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Lorna Mitchell's Blog: Building A RESTful PHP Server: Routing the Request]]></title>
      <guid>http://www.phpdeveloper.org/news/17433</guid>
      <link>http://www.phpdeveloper.org/news/17433</link>
      <description><![CDATA[<p>
<i>Lorna Mitchell</i> is back with a second installment in her "Building a RESTful PHP Server" series with <a href="http://www.lornajane.net/posts/2012/building-a-restful-php-server-routing-the-request">this new post</a> about handling and routing the incoming requests. (You can find the first part about working with the request <a href="http://phpdeveloper.org/news/17418">here</a>)
</p>
<blockquote>
This is the second part of a series, showing how you might write a RESTful API using PHP. This part covers the routing, autoloading, and controller code for the service, and follows on from the first installment which showed how to parse the incoming request to get all the information you need.
</blockquote>
<p>
She shows how to grab the controller name from the incoming request (based on her previous code), create the object for it and execute the requested action name. Also included is a sample autoloader and a basic controller - a UsersController with "getAction" and "postAction" 
 methods for responding to GET and POST requests.
</p>]]></description>
      <pubDate>Mon, 23 Jan 2012 11:14:11 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[ZendCasts.com: Introducing Action Helpers]]></title>
      <guid>http://www.phpdeveloper.org/news/15364</guid>
      <link>http://www.phpdeveloper.org/news/15364</link>
      <description><![CDATA[<p>
On ZendCasts.com there's <a href="http://www.zendcasts.com/introducing-action-helpers/2010/10/">a new screencast posted</a> introducing you to the Zend Framework feature called "action helpers".
</p>
<blockquote>
A look at how Action Helpers can help you build controller-level-functionality without duplicating code.
</blockquote>
<p>
<a href="http://framework.zend.com/manual/en/zend.controller.actionhelpers.html">Action helpers</a> allow you to, at runtime, push code into the processing of a controller to make changing the processing of your controllers simpler than changing its actual code. You can also find a good guide on getting the helpers working in the <a href="http://framework.zend.com/manual/en/zend.controller.actionhelpers.html">Zend Framework manual</a>.
</p>]]></description>
      <pubDate>Mon, 01 Nov 2010 13:50:08 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Matthew Weier O'Phinney's Blog: Using Action Helpers To Implement Re-Usable Widgets]]></title>
      <guid>http://www.phpdeveloper.org/news/15229</guid>
      <link>http://www.phpdeveloper.org/news/15229</link>
      <description><![CDATA[<p>
<i>Matthew Weier O'Phinney</i> has a new post to his blog today showing you how to use <a href="http://weierophinney.net/matthew/archives/246-Using-Action-Helpers-To-Implement-Re-Usable-Widgets.html">action helpers to make widgets</a> that you can reuse all over your Zend Framework application. His method doesn't use the "action()" helper, either.
</p>
<blockquote>
The situation all started when <a href="http://twitter.com/andriesss">Andries</a> tweeted asking about what he considered some mis-behavior on the part of the action() view helper -- a situation that turned out not to be an issue, per se, but more a case of bad architecture within Zend Framework. [...] The helper was done this way because Zend Framework does not render views a single time -- it instead renders after each action, and accumulates views to render in the layout.
</blockquote>
<p>
Instead, he offers <a href="http://weierophinney.net/matthew/archives/233-Responding-to-Different-Content-Types-in-RESTful-ZF-Apps.html">action</a> <a href="http://weierophinney.net/matthew/archives/235-A-Simple-Resource-Injector-for-ZF-Action-Controllers.html">helpers</a> as a solution. He gives an example of a user module that has views, helpers and forms but no controllers, including a Bootstrap file. This bootstrap defines the helpers, configuration file and adds the helpers into the process flow of the application. Once things are all set up and the action helper is created, adding the module to a page is as easy as calling "createProfileWidget()" into a partial view.
</p>]]></description>
      <pubDate>Tue, 05 Oct 2010 09:12:19 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPBuilder.com: Use Zend Framework Action Helpers to Reduce PHP Code Redundancy]]></title>
      <guid>http://www.phpdeveloper.org/news/15133</guid>
      <link>http://www.phpdeveloper.org/news/15133</link>
      <description><![CDATA[<p>
On PHPBuilder.com today there's <a href="http://www.phpbuilder.com/columns/zend-action-helpers/Jason_Gilmore091410.php3">a new tutorial</a> from <i>Jason Gilmore</i> about using the action helpers in the Zend Framework to help reduce the amount of redundant code spread all over your application.
</p>
<blockquote>
Embracing a framework-driven approach to Web development enhances productivity in many ways, not the least of which is the ability to stay DRY (<a href="http://en.wikipedia.org/wiki/Don%27t_repeat_yourself">Don't Repeat Yourself</a>). Eliminating the redundant reuse of code throughout a Web application will greatly improve your ability to effectively test and later refactor code, not to mention locate and diagnose the inevitable bugs that will creep into the project. [...] The Zend Framework refers to these reusable logical snippets as action helpers, and in this article I'll show you how to create, configure and execute action helpers within your Zend Framework-powered applications.
</blockquote>
<p>
He walks you through the steps of creating an action helper to create a simple one-time URL for an example application's email confirmation links. The class (WJG_Controller_Action_Helper_GenerateID) extends the abstract action controller and generates the code to append to the URL. When the code is needed, the helper can just be called directly and the string is returned for use in multiple types of emails.
</p>]]></description>
      <pubDate>Wed, 15 Sep 2010 11:49:52 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Rob Allen's Blog: Zend Framework's Flash Messenger action helper]]></title>
      <guid>http://www.phpdeveloper.org/news/15006</guid>
      <link>http://www.phpdeveloper.org/news/15006</link>
      <description><![CDATA[<p>
<i>Rob Allen</i> has <a href="http://akrabat.com/zend-framework/zend-frameworks-flash-messenger-action-helper/">a new post</a> to his blog today about <a href="http://framework.zend.com/manual/en/zend.controller.actionhelpers.html#zend.controller.actionhelpers.flashmessenger">a handy helper</a> that comes with the Zend Framework to help you store messages between requests.
</p>
<blockquote>
I've talked about Zend Framework's action helpers <a href="http://akrabat.com/zend-framework/hooks-in-action-helpers/">before</a>, but haven't covered any of the action helpers that are supplied with Zend Framework. <a href="http://framework.zend.com/manual/en/zend.controller.actionhelpers.html#zend.controller.actionhelpers.flashmessenger">FlashMessenger</a> is a helper that allows you to store messages between requests. The most common use I have for it is for a "saved" message after doing an edit of an item that then redirects back to a list.
</blockquote>
<p>
He includes an example of this helper in action in storing a sample message and pulling it back out on the other side. The message insert also includes a redirect() call and the output has a code snippet to check the messages property to see if there's any to show.
</p>]]></description>
      <pubDate>Tue, 24 Aug 2010 09:57:33 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Matthew Weier O'Phinney's Blog: A Simple Resource Injector for ZF Action Controllers]]></title>
      <guid>http://www.phpdeveloper.org/news/14228</guid>
      <link>http://www.phpdeveloper.org/news/14228</link>
      <description><![CDATA[<p>
<i>Matthew Weier O'Phinney</i> has posted an answer to a request a fellow PHP community <a href="http://www.brandonsavage.net/">member</a> had about using bootstrap resources in actions in your Zend Framework application. <a href="http://weierophinney.net/matthew/archives/235-A-Simple-Resource-Injector-for-ZF-Action-Controllers.html">This post</a> shows how it can be done in a proof of concept.
</p>
<blockquote>
Basically, he'd like to see any resource initialized by the bootstrap immediately available as simply a public member of his action controller. So, for instance, if you were using the "DB" resource in your application, your controller could access it via $this->db. I quickly drafted up a proof of concept for him using an action helper.
</blockquote>
<p>
The resource injection helper extends the Zend_Controller_Action_Helper_Abstract and allows you to name the resources you'd like pushed into the controller as a part of the bootstrap process. There's an issue with the approach, though - lack of controller over what's actually injected so he modified it to push the dependency list in from the controller rather than limiting it to the bootstrap.
</p>]]></description>
      <pubDate>Mon, 22 Mar 2010 15:17:50 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Federico Cargnelutti's Blog: Testing Zend Framework Action Controllers With Mocks]]></title>
      <guid>http://www.phpdeveloper.org/news/13462</guid>
      <link>http://www.phpdeveloper.org/news/13462</link>
      <description><![CDATA[<p>
In <a href="http://blog.fedecarg.com/2009/11/01/testing-zend-framework-action-controllers-with-mocks/">this new post</a> to his blog today <i>Federico Cargnelutti</i> shows you how to use mock objects to unit test controllers in your Zend Framework application.
</p>
<blockquote>
In this post I'll demonstrate a unit test technique for testing Zend Framework Action Controllers using Mock Objects. Unit testing controllers independently has a number of advantages: you can develop controllers test-first (TDD), develop and test all of your controller code before developing any of the view scripts and helps you quickly identify problems in the controller, rather than problems in one of the combination of Model, View and Controller.
</blockquote>
<p>
He sets up a sample user controller and a test case to go along with it. Drop in a test for the user controller class that uses a "getMock" method to define a mock controller object for the "render" method. He also points out a few issues with this sort of testing in the Zend Framework - the return value of the Zend_Test_PHPUnit_ControllerTestCase, issues throwing exceptions with the Front Controller and a problem with the dispatcher's storage of the Action Controller.
</p>]]></description>
      <pubDate>Mon, 02 Nov 2009 07:58:44 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Lorna Mitchell's Blog: PHPUnit with Zend_Controller_Action_Helper]]></title>
      <guid>http://www.phpdeveloper.org/news/12927</guid>
      <link>http://www.phpdeveloper.org/news/12927</link>
      <description><![CDATA[<p>
<i>Lorna Mitchell</i> has <a href="http://www.lornajane.net/posts/2009/PHPUnit-with-Zend_Controller_Action_Helper">posted about</a> another aspect of the REST project she's been developing and an issue that's come up with testing with <a href="http://phpunit.de">PHPUnit</a>.
</p>
<blockquote>
I ran into problems very quickly - when I tried to write the first unit test for the first action in fact! PHPUnit was just dying when I asked it to dispatch() any URL which didn't return HTML, it wasn't even giving its usual output. What was actually happening was I was making use of Zend_Controller_Action_Helper_Json, my service returns JSON and this action helper takes input, transforms it into JSON, sets the content-type correctly and tells ZF not to look for a view since we don't need one. I thought this was pretty neat.
</blockquote>
<p>
As it turns out, there was an <a href="http://php.net/exit">exit</a> being called in the Zend_Controller_Action_Helper_Json component that was causing the request to stop at a certain point. The solution? Chaning the value of the supressExit class variable to stop the behavior.
</p>]]></description>
      <pubDate>Thu, 23 Jul 2009 07:50:20 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Timothy Boronczyk's Blog: What's Wrong with OOP]]></title>
      <guid>http://www.phpdeveloper.org/news/12662</guid>
      <link>http://www.phpdeveloper.org/news/12662</link>
      <description><![CDATA[<p>
In <a href="http://zaemis.blogspot.com/2009/06/whats-wrong-with-oop.html">this new post</a> to his blog <i>Timothy Boronczyk</i> has a few suggestions about what's wrong with the current implementation of object oriented programming in most languages (including PHP).
</p>
<blockquote>
Proponents of Object Oriented Programming feel the paradigm yields code that is better organized, easier to understand and maintain, and reusable. [...] If objects truly model the way people think of things in the real world, then why do people have a hard time understanding and working in OOP? I suspect the problem might be the focus on objects instead of actions.
</blockquote>
<p>
He goes on to explain that, in his opinion, the functionality would be more understandable if it focused on the actions from the user's point of view rather than what the object itself can do.
</p>
<blockquote>
The way some OOP languages (like Java and C#) force objects on the programmer borders on the absurd. [...] Sadly though, that decision isn't left to the programmer who has been tasked with developing and maintaining a system. 
</blockquote>]]></description>
      <pubDate>Thu, 11 Jun 2009 08:44:05 -0500</pubDate>
    </item>
  </channel>
</rss>
