<?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>Sun, 12 Feb 2012 21:56:20 -0600</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Fabien Potencier's Blog: Create your own framework... on top of the Symfony2 Components (part 12)]]></title>
      <guid>http://www.phpdeveloper.org/news/17445</guid>
      <link>http://www.phpdeveloper.org/news/17445</link>
      <description><![CDATA[<p>
In <a href="http://fabien.potencier.org/article/62/create-your-own-framework-on-top-of-the-symfony2-components-part-12">this final post</a> of his series about building a framework on Symfony2 components, <i>Fabien Potencier</i> focuses again on flexibility - allowing you to have more than one front controller with different configurations thanks to dependency injections.
</p>
<blockquote>
Does it means that we have to make a choice between flexibility, customization, ease of testing and not having to copy and paste the same code into each application front controller? As you might expect, there is a solution. We can solve all these issues and some more by using the Symfony2 dependency injection container.
</blockquote>
<p>
The Symfony2 DIC (DependencyInjection) allows you to create a container with the objects and settings that you want and inject that into the main "Framework" class for its use. He registers most of the components he's added over the series like the UrlMatcher, RouterListener, ExceptionListener, EventDispatcher and the Framework class itself. This is all stored in a separate file(s) and can be conditionally included based on your environment. He shows how to register a custom listener, add parameters to the DIC configuration.
</p>]]></description>
      <pubDate>Wed, 25 Jan 2012 08:36:48 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Fabien Potencier's Blog: Create your own framework... on top of the Symfony2 Components (part 11)]]></title>
      <guid>http://www.phpdeveloper.org/news/17440</guid>
      <link>http://www.phpdeveloper.org/news/17440</link>
      <description><![CDATA[<p>
In <a href="http://fabien.potencier.org/article/60/create-your-own-framework-on-top-of-the-symfony2-components-part-11">part eleven</a> of his "Build a Framework on top of Symfony2", <i>Fabien Potencier</i> improves on his earlier versions of the code by adding in the HttpKernel support for handling events and errors that might come up in the application.
</p>
<blockquote>
If you were to use our framework right now, you would probably have to add support for custom error messages. Right now, we have 404 and 500 error support but the responses are hardcoded in the framework itself. Making them customizable is easy enough though: dispatch a new event and listen to it. Doing it right means that the listener has to call a regular controller. But what if the error controller throws an exception? You will end up in an infinite loop. There should be an easier way, right?
</blockquote>
<p>
Using the "RouterListener" functionality, he sets up an "ExceptionListener" and points that to an error handling controller with its own "exceptionAction". This action takes the exception information and displays a "Something went wrong!" message along with the details. He also includes an update to the Response handling to allow for returning a string back from the controller instead of a Response object.
</p>]]></description>
      <pubDate>Tue, 24 Jan 2012 11:04:44 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Fabien Potencier's Blog: Create your own framework... on top of the Symfony2 Components (part 10)]]></title>
      <guid>http://www.phpdeveloper.org/news/17432</guid>
      <link>http://www.phpdeveloper.org/news/17432</link>
      <description><![CDATA[<p>
<i>Fabien Potencier</i> has posted <a href="http://fabien.potencier.org/article/59/create-your-own-framework-on-top-of-the-symfony2-components-part-10">the tenth part</a> of his series about making a custom framework based on the <a href="http://symfony.com">Symfony2</a> component set. In this latest article he focuses on using the HttpKernelInterface to add in some additional HTTP-related support.
</p>
<blockquote>
In the conclusion of the second part of this series, I've talked about one great benefit of using the Symfony2 components: the interoperability between all frameworks and applications using them. Let's do a big step towards this goal by making our framework implement HttpKernelInterface.
</blockquote>
<p>
By changing up the custom framework just a bit to use HttpKernelInterface, you get built-in HTTP <a href="http://symfony.com/doc/current/book/http_cache.html">caching</a> (HttpCache). He shows how to use this class to create some custom caching rules and how to use <a href="http://en.wikipedia.org/wiki/Edge_Side_Includes">Edge Side Includes</a> to only cache partial parts of the page.
</p>]]></description>
      <pubDate>Mon, 23 Jan 2012 10:55:22 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Fabien Potencier's Blog: Create your own framework... on top of the Symfony2 Components (part 9)]]></title>
      <guid>http://www.phpdeveloper.org/news/17416</guid>
      <link>http://www.phpdeveloper.org/news/17416</link>
      <description><![CDATA[<p>
<i>Fabien Potencier</i> has posted the <a href="http://fabien.potencier.org/article/58/create-your-own-framework-on-top-of-the-symfony2-components-part-9">ninth part</a> of his "build a framework on Symfony2 components</a> series. In this latest tutorial he takes the simple framework he's already created (complete with some unit tests) and makes it easier to extend.
</p>
<blockquote>
Our framework is still missing a major characteristic of any good framework: extensibility. Being extensible means that the developer should be able to easily hook into the framework life cycle to modify the way the request is handled.
</blockquote>
<p>
He chooses the Observer design pattern as a basis for his example, allowing any kind of behavior/actions to be added to the framework's execution. He includes the Symfony2 dispatcher to make this work and includes the code for a "handle" method to fire off events. It executes a "ResponseEvent" every time the framework is executed. An "addListener" method provides the hook to apply a callback to an event - in his case an anonymous function (or closure).
</p>]]></description>
      <pubDate>Thu, 19 Jan 2012 08:58:11 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Fabien Potencier's Blog: Create your own framework... on top of the Symfony2 Components (part 8)]]></title>
      <guid>http://www.phpdeveloper.org/news/17404</guid>
      <link>http://www.phpdeveloper.org/news/17404</link>
      <description><![CDATA[<i>Fabien Potencier</i> has posted the <a href="http://fabien.potencier.org/article/57/create-your-own-framework-on-top-of-the-symfony2-components-part-8">eighth part</a> in his "building a framework on Symfony2 components" series. So far he's created a <a href="http://fabien.potencier.org/article/50/create-your-own-framework-on-top-of-the-symfony2-components-part-1">full</a>-<a href="http://fabien.potencier.org/article/51/create-your-own-framework-on-top-of-the-symfony2-components-part-2">featured</a> <a href="http://fabien.potencier.org/article/52/create-your-own-framework-on-top-of-the-symfony2-components-part-3">microframework</a> with <a href="http://fabien.potencier.org/article/53/create-your-own-framework-on-top-of-the-symfony2-components-part-4">routing</a>, <a href="http://fabien.potencier.org/article/54/create-your-own-framework-on-top-of-the-symfony2-components-part-5">controllers</a>, <a href="http://fabien.potencier.org/article/55/create-your-own-framework-on-top-of-the-symfony2-components-part-6">HTTP handling</a> and <a href="http://fabien.potencier.org/article/56/create-your-own-framework-on-top-of-the-symfony2-components-part-7">namespaced code</a>. In this latest part he improves the sample framework by adding some unit tests.
</p>
<blockquote>
Some watchful readers pointed out some subtle but nonetheless important bugs in the framework we have built yesterday. When creating a framework, you must be sure that it behaves as advertised. If not, all the applications based on it will exhibit the same bugs. The good news is that whenever you fix a bug, you are fixing a bunch of applications too. Today's mission is to write unit tests for the framework we have created by using <a href="http://www.phpunit.de/manual/current/en/index.html">PHPUnit</a>.
</blockquote>
<p>
He includes the XML for a basic phpunit.xml configuration file and uses a UrlMatcher and ControllerResolver in a "Framework" class and makes the test check for "not found" URLs and for checking for a correct Response.
</p>]]></description>
      <pubDate>Tue, 17 Jan 2012 09:39:26 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Fabien Potencier's Blog: Create your own framework... on top of the Symfony2 Components (part 7)]]></title>
      <guid>http://www.phpdeveloper.org/news/17396</guid>
      <link>http://www.phpdeveloper.org/news/17396</link>
      <description><![CDATA[<p>
<i>Fabien Potencier</i> has posted the <a href="http://fabien.potencier.org/article/56/create-your-own-framework-on-top-of-the-symfony2-components-part-7">seventh part</a> of his series looking at how to make a custom framework on top of the components from the <a href="http://symfony.com">Symfony2</a> framework. In this part of the series he improves his basic framework by adding some namespacing to organize the application a bit more.
</p>
<blockquote>
If you have a closer look at the code, front.php has one input, the Request, and one output, the Response. Our framework class will follow this simple principle: the logic is about creating the Response associated with a Request. As the Symfony2 components requires PHP 5.3, let's create our very own namespace for our framework: Simplex.
</blockquote>
<p>
He puts the main front controller in just the "Simplex" namespace but adds in others for the controllers and models. He also updates his Composer configuration to create some PSR-0 autoloading.
</p>]]></description>
      <pubDate>Mon, 16 Jan 2012 08:46:22 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Fabien Potencier's Blog: Create your own framework... on top of the Symfony2 Components (part 5)]]></title>
      <guid>http://www.phpdeveloper.org/news/17384</guid>
      <link>http://www.phpdeveloper.org/news/17384</link>
      <description><![CDATA[<p>
<i>Fabien Potencier</i> has posted the <a href="http://fabien.potencier.org/article/54/create-your-own-framework-on-top-of-the-symfony2-components-part-5">fifth part</a> of his series looking at building a custom framework on top of the <a href="http://symfony.com">Symfony2</a> components. In this new tutorial he adds in one of the major features of any framework - the controller level.
</p>
<blockquote>
For simple pages like the ones we have created so far, that's not a problem, but if you want to add more logic, you would be forced to put the logic into the template itself, which is probably not a good idea, especially if you still have the separation of concerns principle in mind. Let's separate the template code from the logic by adding a new layer: the controller: The controller mission is to generate a Response based on the information conveyed by the client Request.
</blockquote>
<p>
He updates the template rendering to use an external method instead of doing it itself and updates the routing to include a "_controller" attribute pointing to the method. The full code for the updated version of the framework is included - a simple request/response with handling for a "leap_year" route.
</p>]]></description>
      <pubDate>Thu, 12 Jan 2012 10:48:17 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Fabien Potencier's Blog: Create your own framework...on top of the Symfony2 Components (parts 3 & 4)]]></title>
      <guid>http://www.phpdeveloper.org/news/17362</guid>
      <link>http://www.phpdeveloper.org/news/17362</link>
      <description><![CDATA[<p>
<i>Fabien Potencier</i> has posted the <a href="http://fabien.potencier.org/article/52/create-your-own-framework-on-top-of-the-symfony2-components-part-3">third</a> and <a href="http://fabien.potencier.org/article/53/create-your-own-framework-on-top-of-the-symfony2-components-part-4">fourth</a> parts of his "Build a framework on top of Symfony2 components</a> series to his blog:
</p>
<ul>
<li><a href="http://fabien.potencier.org/article/52/create-your-own-framework-on-top-of-the-symfony2-components-part-3">Part three</a> adds on another page to the sample site, creating a front controller and changing the output to use "setContent()" instead of just echoing the data.
<li>In <a href="http://fabien.potencier.org/article/53/create-your-own-framework-on-top-of-the-symfony2-components-part-4">part four</a> he refactors the code to be a bit more readable, adds in the Symfony2 Routing component to correctly get the requests to the right controller and an example of how to generate routes based on route definitions.
</ul>
<p>
You can find the other parts of the series here: <a href="http://fabien.potencier.org/article/50/create-your-own-framework-on-top-of-the-symfony2-components-part-1">part one</a>, <a href="http://fabien.potencier.org/article/51/create-your-own-framework-on-top-of-the-symfony2-components-part-2">part two</a>.
</p>]]></description>
      <pubDate>Mon, 09 Jan 2012 09:31:55 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Fabien Potencier's Blog: Create your own framework... on top of the Symfony2 Components (part 2)]]></title>
      <guid>http://www.phpdeveloper.org/news/17348</guid>
      <link>http://www.phpdeveloper.org/news/17348</link>
      <description><![CDATA[<p>
<i>Fabien Potencier</i> is back with the next installment of his "Building a framework on top of Symfony2" tutorial series with <a href="http://fabien.potencier.org/article/51/create-your-own-framework-on-top-of-the-symfony2-components-part-2">this look at using the HttpFoundation component</a> to use the Request and Response classes to handle HTTP interaction. (Part one <a href="http://phpdeveloper.org/news/17343">is here</a>.)
</p>
<blockquote>
The first step towards better code is probably to use an Object-Oriented approach; that's the main goal of the Symfony2 HttpFoundation component: replacing the default PHP global variables and functions by an Object-Oriented layer.
</blockquote>
<p>
He shows how using this component not only makes OOP handling of requests/responses simpler, but also helps to make your application more secure through features already included in the HttpFoundation component. Sample code is included showing how to fetch the current request, get filtered values from the superglobals (GET/SERVER/etc) and how to respond with a refactored version of the "Hello world" message from the <a href="http://phpdeveloper.org/news/17343">previous example</a>. 
</p>]]></description>
      <pubDate>Thu, 05 Jan 2012 08:11:27 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Fabien Potencier's Blog: Create your own framework... on top of the Symfony2 Components (part 1)]]></title>
      <guid>http://www.phpdeveloper.org/news/17343</guid>
      <link>http://www.phpdeveloper.org/news/17343</link>
      <description><![CDATA[<p>
<i>Fabien Potencier</i> has written up a new post on his blog talking about <a href="http://fabien.potencier.org/article/50/create-your-own-framework-on-top-of-the-symfony2-components-part-1">creating your own framework</a> layered on top of the Symfony2 framework's component system (yes, a framework from a framework).
</p>
<blockquote>
Symfony2 is a reusable set of standalone, decoupled, and cohesive PHP components that solve common web development problems. Instead of using these low-level components, you can use the ready-to-be-used Symfony2 full-stack web framework, which is based on these components... or you can create your very own framework. This series is about the latter.
</blockquote>
<p>
He talks about the reasoning behind wanting to make your own framework, mostly dealing with exploration and/or proving you can do it. He walks you through every step of the way - creating the base directory, setting up a project via <a href="http://packagist.org/about-composer">Composer</a>, creating an autoloader and making a first basic file - a "Hello world" echo message. In the next part of the series, he'll add in the HttpFoundation component for web interaction.
</p>]]></description>
      <pubDate>Wed, 04 Jan 2012 08:47:39 -0600</pubDate>
    </item>
  </channel>
</rss>

