<?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 08:17:15 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[NetTuts.com: Testing Laravel Controllers]]></title>
      <guid>http://www.phpdeveloper.org/news/19499</guid>
      <link>http://www.phpdeveloper.org/news/19499</link>
      <description><![CDATA[<p>
NetTuts.com has posted a new article for the Laravel users out there - a tutorial showing how to <a href="http://net.tutsplus.com/tutorials/php/testing-laravel-controllers/">test Laravel controllers</a> via PHPUnit tests.
</p>
<blockquote>
Testing controllers isn't the easiest thing in the world. Well, let me rephrase that: testing them is a cinch; what's difficult, at least at first, is determining what to test. Should a controller test verify text on the page? Should it touch the database? Should it ensure that variables exist in the view? If this is your first hay-ride, these things can be confusing! Let me help.
</blockquote>
<p>
They break up the testing process into three main chunks - isolation of the tests (mocking where need be), calling the controller method and running the checks (assertions) to be sure the result is valid. They start with a basic controller test that runs a GET request on the "posts" method. They also mention the assertion helper methods included with Laravel controller testing, things like "assertRedirectedTo" and "assertSessionHas". The article then gets into moreo practical examples showing a TDD approach to testing some simple controller calls, mocking data connections, handling redirects and repositories.
</p>
Link: http://net.tutsplus.com/tutorials/php/testing-laravel-controllers]]></description>
      <pubDate>Wed, 24 Apr 2013 09:24:06 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Dave Marshall: Silex Route Helpers for a Cleaner Architecture]]></title>
      <guid>http://www.phpdeveloper.org/news/18808</guid>
      <link>http://www.phpdeveloper.org/news/18808</link>
      <description><![CDATA[<p>
In a <a href="http://phpdeveloper.org/news/18549">previous post</a> of his <i>Dave Marshall</i> talked about using controllers as "services" in a Silex-based application. In <a href="http://davedevelopment.co.uk/2012/11/27/silex-route-helpers-for-a-cleaner-architecture.html">this new post</a> he takes it a step further and shows you how to use route helpers to make working with those controllers even simpler.
</p>
<blockquote>
Supposing we want to render some HTML, do we want to inject the template engine in to the controller? Should the controller be responsible for knowing how to render the template? I'm not sure, but if I can have it not do it with minimal fuss, I think I'd rather it not. The full stack framework has the <a href="http://symfony.com/doc/2.0/bundles/SensioFrameworkExtraBundle/annotations/view.html">@Template</a> annotation, which allows developers to assign a template to a controller and then simply return an array. If they can do it in the full stack framework, we can do it in Silex.
</blockquote>
<p>
He includes the code for an example of a 404 handling page that uses the "convert" method to configure a route (path to a controller) for the currently matched route. He also shows the creation of a simple "CustomRoute" class and a "TemplateRenderingListener" to make it simpler to customize the handling and output of the request, all injected into the application's DI for later use.
</p>]]></description>
      <pubDate>Tue, 27 Nov 2012 10:57:16 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Robert Basic: Working with custom view helpers in Zend Framework 2]]></title>
      <guid>http://www.phpdeveloper.org/news/18468</guid>
      <link>http://www.phpdeveloper.org/news/18468</link>
      <description><![CDATA[<p>
In his latest post <i>Robert Basic</i> looks at <a href="http://robertbasic.com/blog/working-with-custom-view-helpers-in-zend-framework-2">working with custom view helpers</a> in your Zend Framework 2 application and shows how to implement a simple one to display a simple greeting.
</p>
<blockquote>
I took the skeleton [Zend Framework 2] application, made it even skinnier by throwing out some (for me) unneeded parts and just put it all besides my old ZF1 code. [...] The first problem I ran into was using custom view helpers, especially view helpers that are more general and don't fit into one specific module. Where to put the code? How to access them in views? The second problem was how to access the service manager from a view helper? And the third problem was how to tell the helper to use a specific value when inside a specific module?
</blockquote>
<p>
He includes a simple example - the greeting helper - and shows where to place it in the application structure, how to work with the service locator inside it and how to set up some module-specific views inside.
</p>]]></description>
      <pubDate>Wed, 12 Sep 2012 09:27:08 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Evan Coury: Creating a simple view helper in Zend Framework 2]]></title>
      <guid>http://www.phpdeveloper.org/news/18353</guid>
      <link>http://www.phpdeveloper.org/news/18353</link>
      <description><![CDATA[<p>
<i>Evan Coury</i> has a new post today showing how to <a href="http://blog.evan.pro/creating-a-simple-view-helper-in-zend-framework-2">create a simple view helper</a> in a Zend Framework 2 based application.
</p>
<blockquote>
This post will show you how to create a simple view helper in Zend Framework 2. In this example, our view helper will simply return the full, absolute URL of the current page/request.
</blockquote>
<p>
Code for the example is included, showing how to pull in the namespaced dependencies and extend the AbstractHelper to define the simple view helper. The "__invoke" method is used to handle the functionality and the configuration for the helper is defined in the Module's "getViewHelperConfig" options. You can find out more about the View Helpers in Zend Framework 2 in <a href="http://packages.zendframework.com/docs/latest/manual/en/modules/zend.view.helpers.html">their manual page</a>.
</p>]]></description>
      <pubDate>Mon, 13 Aug 2012 13:24:10 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Matt Cockayne: Bootstrapping ZF2 Forms]]></title>
      <guid>http://www.phpdeveloper.org/news/18260</guid>
      <link>http://www.phpdeveloper.org/news/18260</link>
      <description><![CDATA[<p>
In <a href="http://devincharge.com/bootstrapping-zf2-forms/">this recent post</a> to his site, <i>Matt Cockayne</i> shows you how to bootstrap your forms in a Zend Framework 2 application (as defined in a class).
</p>
<blockquote>
A brand spanking new Forms component has been rolled out with <a href="https://github.com/zendframework/zf2">ZF2</a>. The long and the short of this new component meant that I had the opportunity to hand roll a new way of making my forms work with <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap</a>. So, a little tinkering, a quick <a href="https://github.com/zendframework/zf2/pull/1893">pull request</a> to <a href="https://github.com/zendframework/zf2">ZF2</a> to allow the definition of arbitrary options and I <a href="https://github.com/zucchi/Zucchi/tree/master/src/Zucchi/Form/View/Helper">came up with some useful View Helpers</a> that can be dropped into a project and used.
</blockquote>
<p>
He includes the code for the sample class ("MyForm") and highlights the "bootstrap" portions of each element's configuration and walks you through some other handy features of his helpers: auto-rendering forms, a "row" helper and a "collection" helper to help organize the form structure.
</p>]]></description>
      <pubDate>Mon, 23 Jul 2012 11:07:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Code2Learn.com: Generating CSV file using CodeIgniter Framework]]></title>
      <guid>http://www.phpdeveloper.org/news/17841</guid>
      <link>http://www.phpdeveloper.org/news/17841</link>
      <description><![CDATA[<p>
The Code2Learn site has posted another in their CodeIgniter "series" about producing various kinds of output from an application based on this framework. In <a href="http://www.code2learn.com/2012/03/generating-csv-file-using-codeigniter.html">this new article</a> <i>Farhan Khwaja</i> shows how to output a CSV-formatted file.
</p>
<blockquote>
I have already written posts on <a href="http://www.code2learn.com/2012/02/generating-pdf-files-from-database.html">how to generate pdf files using CodeIgniter Framework</a> and also on <a href="http://www.code2learn.com/2012/03/generating-tabulated-pdf-file-from.html">how to generate tabulated pdf file using CodeIgniter Framework</a>.  This post will help you to generate a CSV file using CodeIgniter. The data for the CSV File will be taken from the MySQL Database and will be put into the CSV File.
</blockquote>
<p>
He includes the source for a basic "Generate" controller class that uses a custom "CSV_Helper" to do the work. It has two methods - one to transform array data and another to take the database result object and extract each record. 
</p>]]></description>
      <pubDate>Thu, 19 Apr 2012 11:45:52 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Code2Learn.com: Generating PDF files from Database using CodeIgniter]]></title>
      <guid>http://www.phpdeveloper.org/news/17606</guid>
      <link>http://www.phpdeveloper.org/news/17606</link>
      <description><![CDATA[<p>
On the Code2Learn blog there's a recent tutorial about <a href="http://www.code2learn.com/2012/02/generating-pdf-files-from-database.html">creating PDFs from CodeIgniter</a> using the <a href="http://www.ros.co.nz/pdf/">R&OS PDF class</a> (not bundled with the framework, but easy to integrate).
</p>
<blockquote>
As a programmer I find PDF files very helpful to me when generating reports and getting them printed. We will be using <a href="http://www.ros.co.nz/pdf/">R&OS pdf class</a>. I find this to be the best one because all others libraries I came across didn't offer me a good control over the making of the file and also the process of making i.e the code required for this library is bit tricky but it helped me improve my coding. 
</blockquote>
<p>
Code is included to create a simple PDF helper class that creates a new "cezpdf" object and add some basic things like titles, page numbers and some basic footer text. A simple controller is included that pulls the information from a database table (in their case a record of logins) and pushes this data into the PDF as lines of text.
</p>]]></description>
      <pubDate>Wed, 29 Feb 2012 12:07:33 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: PHP Closures as View Helpers: Lazy-Loading File Data]]></title>
      <guid>http://www.phpdeveloper.org/news/17466</guid>
      <link>http://www.phpdeveloper.org/news/17466</link>
      <description><![CDATA[<p>
In the second part of their look at using closures in PHP as view helpers, DevShed improves upon <a href="http://phpdeveloper.org/news/17446">their original code</a> by adding some additional classes and <a href="http://www.devshed.com/c/a/PHP/PHP-Closures-as-View-Helpers-LazyLoading-File-Data/">using them in the closures</a>.
</p>
<blockquote>
The best way to show you how using anonymous functions can help you to develop more efficient OO applications is with some functional, hands-on examples. With this idea in mind, in the installment that preceded this one, I implemented an extendable template system. This system could spawn view objects and render the template files associated with these objects.
</blockquote>
<p>
In this second part of the (two-part) series they include "Serializer" and "FileHandler" classes and show how to use them inside of the closures to lazy-load in data from an external file and work with it as serialized content.
</p>]]></description>
      <pubDate>Mon, 30 Jan 2012 13:08:28 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Project: Patchwork-UTF8 - UTF8 Support for PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17458</guid>
      <link>http://www.phpdeveloper.org/news/17458</link>
      <description><![CDATA[<p>
<i>Nicolas Grekas</i> has shared another tool that he's pulled out of his "Patchwork" framework to make it a stand-alone tool: the <a href="https://github.com/nicolas-grekas/Patchwork-UTF8">Patchwork-UTF8 helper</a> that provides matching functions to those PHP already has for regular strings, but a little smarter to work with UTF8 correctly.
</p>
<blockquote>
The PatchworkUtf8 class implements the quasi complete set of string functions that need UTF-8 grapheme clusters awareness. These functions are all static methods of the PatchworkUtf8 class. The best way to use them is to add a use PatchworkUtf8 as u; at the beginning of your files, then when UTF-8 awareness is required, prefix by u:: when calling them.
</blockquote>
<p>
In <a href="https://github.com/nicolas-grekas/Patchwork-UTF8/blob/master/README.md">the README</a> for the tool he talks about the functions included in the current release that match PHP's string functions as well as some additional methods like "isUtf8", "bestFit" and "strtocasefold". It relies on the mbstring, iconv and intl extensions being installed, and if they aren't, it falls back to other functionality (list of those methods included).
</p>]]></description>
      <pubDate>Fri, 27 Jan 2012 11:38:40 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Using Closures as View Helpers]]></title>
      <guid>http://www.phpdeveloper.org/news/17446</guid>
      <link>http://www.phpdeveloper.org/news/17446</link>
      <description><![CDATA[<p>
New on DevShed today there's a tutorial looking at using one of the newer features of PHP, closures, <a href="http://www.devshed.com/c/a/PHP/Using-PHP-Closures-as-View-Helpers/">as view helpers</a> in a basic templating system.
</p>
<blockquote>
In this two-part tutorial I'll be showing you, in a step-by-step fashion, how to use the goodies offered by closures in the implementation of an object-based, easily extendable template system. This system will allow you to embed anonymous functions easily into template files, and call them as typical view helpers, too.
</blockquote>
<p>
He starts the process of creating the templating system by defining two interfaces, the View and DataHandler. Using these as a base, he creates an instance of the ViewInterface (a "View" class) that can set the template file to use, set values to be displayed and render the formatted output. Included is a basic template and how to use the View class to set values into it. The "render" method is called on the view and the HTML markup is produced. The closure comes in when they try to call a value "clientIp" that needs to do something more complicated than just having a string assigned to it.
</p>]]></description>
      <pubDate>Wed, 25 Jan 2012 09:50:38 -0600</pubDate>
    </item>
  </channel>
</rss>
