<?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>Mon, 21 May 2012 10:02:09 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Gonzalo Ayuso's Blog: Building a simple SQL wrapper with PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17953</guid>
      <link>http://www.phpdeveloper.org/news/17953</link>
      <description><![CDATA[<p>
In <a href="http://gonzalo123.wordpress.com/2012/05/14/building-a-simple-sql-wrapper-with-php/">this new post</a> to his blog <i>Gonzalo Ayuso</i> has shared a simple SQL wrapper that he uses to work with his databases. It takes in an injection of the database connection component (a href="http://php.net/pdo">PDO</a>) and provides functionality for inserts, updates, etc. with transaction support.
</p>
<blockquote>
If we don't use an ORM within our projects we need to write SQL statements by hand. I don't mind to write SQL. It's simple and descriptive but sometimes we like to use helpers to avoid write the same code again and again. Today we are going to create a simple library to help use to write simple SQL queries.
</blockquote>
<p>
It's a <a href="https://github.com/gonzalo123/sqlWrapper">lightweight library</a> that'd be good for basic uses, but when you start getting into something a bit more complex, something like <a href="http://www.doctrine-project.org/">Doctrine2</a> or <a href="http://www.propelorm.org/">Propel</a> might be a better solution (or whatever your framework of choice has built in).
</p>]]></description>
      <pubDate>Mon, 14 May 2012 10:17:10 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[GotoTech.com: Developer Diary: Taming Doctrine's 2000 Flushes]]></title>
      <guid>http://www.phpdeveloper.org/news/17897</guid>
      <link>http://www.phpdeveloper.org/news/17897</link>
      <description><![CDATA[<p>
In <a href="http://gototech.com/?p=221">this new post</a> to the GotoTech.com blog <i>Eric Burns</i> talks about a way he's "tamed Doctrine's 2000 flushes" with a wrapper around the EntityManager to make controlling the database flushes simpler.
</p>
<blockquote>
For my project I decided to use the Doctrine 2 ORM to manage my data layer. We also use this at work, so the biggest reason I chose this was to be able to learn more about Doctrine to help me in my job. But this decision also makes sense for my project because my entity relationships will likely be fairly straightforward for the most part and using an ORM will allow me to make a lot of progress very quickly without (I hope) causing me lots of trouble later on.
</blockquote>
<p>
His handy wrapper (Data Manager) makes it simpler to perform the flush and still take transactions into consideration. His simple class includes "flush", "commit" and "startTransaction" methods that don't actually perform the flush until the commit is called.
</p>]]></description>
      <pubDate>Wed, 02 May 2012 10:19:35 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DZone.com: Testing PHP scripts]]></title>
      <guid>http://www.phpdeveloper.org/news/17870</guid>
      <link>http://www.phpdeveloper.org/news/17870</link>
      <description><![CDATA[<p>
In <a href="http://css.dzone.com/articles/testing-php-scripts">this new post</a> to DZone.com, <i>Giorgio Sironi</i> talks about a method of testing that's non-invasive when you're in a chicken-and-egg kind of situation:
</p>
<blockquote>
The legacy code dilemma, however, is always present: you can't refactor the code before putting up some tests on it to avoid regressions and putting your application offline. At the same time, you can't easily unit test the code until some refactoring is introduced.
</blockquote>
<p>
He suggests making copies of some files to allow you to make small changes where needed to "mock" resources in the application to prevent it from accessing the actual data sources. His method fakes HTTP requests to the script and uses the copy of the script as an internal resource. Don't worry, code is included showing how its done - a basic "ForumPosting" class that includes the needed file and wraps the output in a buffer.
</p>]]></description>
      <pubDate>Thu, 26 Apr 2012 10:50:24 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: An Introduction to Services]]></title>
      <guid>http://www.phpdeveloper.org/news/17771</guid>
      <link>http://www.phpdeveloper.org/news/17771</link>
      <description><![CDATA[<p>
On PHPMaster.com today there's a new article from <i>Alejandro Gervasio</i> introducing you to <a href="http://phpmaster.com/an-introduction-to-services/">the concept of "services"</a>, a layer put on top of your models to make a common API that's easier to reuse.
</p>
<blockquote>
Don't let the definition freak you out, as if you've been using MVC for a while the chances are you've used a service already. Controllers are often called services, as they carry out application logic and additionally are capable of interfacing to several client layers, namely views. Of course in a more demanding environment, plain controllers fail short in handling several clients without the aforementioned duplicating, so that's why the construction of a standalone layer is more suitable in such cases.
</blockquote>
<p>
He explains the process behind creating a simple domain model (<a href="http://cdn.phpmaster.com/files/2012/02/service_diagram.png">image here</a>)  and shows how the Service layer wraps it up into a simpler interface, leaving the model to handle the business logic. He uses the example of an "EncoderInterface" that's implemented in a "JsonEncoder" and "Serializer" to both provide a "setData" method. 
</p>]]></description>
      <pubDate>Tue, 03 Apr 2012 13:12:16 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Leaseweb Labs Blog: Migration to Symfony2 continued]]></title>
      <guid>http://www.phpdeveloper.org/news/17525</guid>
      <link>http://www.phpdeveloper.org/news/17525</link>
      <description><![CDATA[<p>
On the LeaseWeb Labs blog there's a continuation from a previous post about migrating your Symfony1 application over to Symfony2. In the <a href="http://phpdeveloper.org/news/17299">first part</a> of this series of posts, <i>Stefan Koopmanschap</i> talked about wrapping your code to make it work. In <a href="http://www.leaseweblabs.com/2012/02/migration-to-symfony2-continued/">this second post</a>, <i>Maurtis van der Schee</i> tackles two issues <i>Stefan</i> mentioned - performance problems and handling authorization/authentication.
</p>
<blockquote>
On December 21, 2011 Stefan Koopmanschap wrote an excellent article on this blog titled "Painless (well, less painful) migration to Symfony2." [...] We were very much inspired by his passionate elucidation and we were fully convinced of the urge to start migrating to Symfony2 as soon as possible. However, he also provided us with a "A word of caution" about 2 things: performance and authentication/authorization. This might get some people worried, but not us: it challenged us to find a solution for those two open issues.
</blockquote>
<p>
They explain why these two things are a problem and some of their solutions they've created - a .htaccess for routing and manually replicating the Symfony2 session in the Symfony1 code. Included in the post are the rewrite rules and code to make these two things happen (and a small configuration change to make them work).
</p>]]></description>
      <pubDate>Thu, 09 Feb 2012 11:51:59 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[VG Tech Blog: Unit Testing with Streams in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17229</guid>
      <link>http://www.phpdeveloper.org/news/17229</link>
      <description><![CDATA[<p>
On the VG Tech blog today there's a new post from <i>Andr&eacute; Roaldseth</i> about using <a href="http://phpunit.de">PHPUnit</a> to <a href="http://tech.vg.no/2011/06/27/unit-testing-with-streams-in-php/">test PHP streams</a>, basing the assertions on the data rather than the functionality itself.
</p>
<blockquote>
Using the memory/temporary stream provided by php:// stream wrapper you  can create a stream with read and write access directly to RAM or to a temporary file [using "php://memory"]. This gives you the possibilty to write unit tests that does not rely on a specific file, resource or stream, but rather on data provided by the test itself.
</blockquote>
<p>
There's no specific code examples here, but you can refer to the <a href="http://us3.php.net/manual/en/wrappers.php.php">stream wrappers</a> section of the PHP manual for more details on this and other handy built-in streams. Once created, it can then be used just as <a href="http://no.php.net/manual/en/book.stream.php">any other stream resource</a> can. This could be useful to provide mocks in your testing, replacing any other stream-able resource with a "memory" or "temp" placeholder.
</p>]]></description>
      <pubDate>Thu, 08 Dec 2011 09:13:28 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[ZetaCode.com: PHP GTK tutorial]]></title>
      <guid>http://www.phpdeveloper.org/news/17149</guid>
      <link>http://www.phpdeveloper.org/news/17149</link>
      <description><![CDATA[<p>
<i>Jan Bodnar</i> has pointed out a <a href="http://zetcode.com/gui/phpgtktutorial/">great PHP-GTK tutorial</a> on ZetaCode.com that walks you through some of the major points of this graphical frontend for PHP:
</p>
<blockquote>
This tutorial will teach you the basics of GUI programming with the PHP GTK. The tutorial has 8 chapters which cover the first steps with the library, menus, toolbars, dialogs and various widgets. It has some examples for drawing with Cairo library. The final chapter presents a small computer game; <a href="http://zetcode.com/gui/phpgtktutorial/nibbles/">The Nibbles</a>.
</blockquote>
<p>
Each of the topics has sample code and screenshots of the resulting output for each. Also included is information on layouts and "painting" with Cairo - drawing shapes, rectangles, text, etc.
</p>]]></description>
      <pubDate>Fri, 18 Nov 2011 12:41:30 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Sameer Borate's Blog: Microsoft Bing Translation PHP wrapper]]></title>
      <guid>http://www.phpdeveloper.org/news/16825</guid>
      <link>http://www.phpdeveloper.org/news/16825</link>
      <description><![CDATA[<p>
In a new post to his blog today <i>Sameer Borate</i> spotlights <a href="http://www.codediesel.com/php/microsoft-bing-translate-php-wrapper/">a translation wrapper for Bing</a> that lets you easily use their API to translate text or determine what language the given text is in.
</p>
<blockquote>
Microsoft Language translation is an interesting service. Not only can you do language translation, you can also detect the language of a particular text. The given class provides a PHP wrapper which will help developers translate text from one language to another in a easy manner. The library also supports caching, helping you keep your translations fast and simple.
</blockquote>
<p>
<a href="http://www.codediesel.com/downloads/bing-php">His translation library</a> requires an <a href="http://www.bing.com/developers/createapp.aspx">AppId</a> for configuration and cURL to handle the messaging back and forth. Translation is as easy as calling "translate()" on a string, language fetching with "LanguageNames()" and even converting the text to speech with the "speak()" method.
</p>]]></description>
      <pubDate>Wed, 07 Sep 2011 09:43:25 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Voices of the ElePHPant: Interview with Michael Maclean]]></title>
      <guid>http://www.phpdeveloper.org/news/16559</guid>
      <link>http://www.phpdeveloper.org/news/16559</link>
      <description><![CDATA[<p>
The Voices of the ElePHPant podcast has release their latest episode today - an <a href="http://voicesoftheelephpant.com/2011/07/07/interview-with-michael-maclean">interview with Michael Maclean</a>, a developer on the Cairo PHP project.
</p>
<p>
<i>Cal</i> asks <i>Michael</i> his "three questions" about his 
</p>
<ul>
<li>Explain to us what Cairo PHP is and why PHP developers should be interested in it.
<li>What is your role in the project and how did you get involved in such a unique project?
<li>Give us some examples of some real-world projects that use Cairo PHP.
</ul>
<p>
You can listen to this new episode either through the <a href="http://voicesoftheelephpant.com/2011/07/07/interview-with-michael-maclean">in-page player</a>, by <a href="http://voices.of.the.elephpant.s3.amazonaws.com/vote_030.mp3">downloading the mp3</a> or by <a href="http://voicesoftheelephpant.com/feed/podcast/">subscribing to their feed</a>.
</p>]]></description>
      <pubDate>Thu, 07 Jul 2011 08:56:10 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DZone.com: Using a stream wrapper to access CouchDb attachments with PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/16264</guid>
      <link>http://www.phpdeveloper.org/news/16264</link>
      <description><![CDATA[<p>
On DZone.com today there's a new post from <i>Gonzalo Ayuso</i> about using a stream wrapper to <a href="http://css.dzone.com/news/using-stream-wrapper-access">access CouchDb database</a> directly from PHP (via a call to its local file).
</p>
<blockquote>
Thanks to a <a href="http://gonzalo123.wordpress.com/2010/09/01/using-monkey-patching-to-store-files-into-couchdb-using-the-standard-filesystem-functions-with-php/#comment-377">comment</a> in my last post (many thanks <a href="http://www.whitewashing.de/">Benjamin</a>) I've discovered that it's possible to create a stream wrapper in <a href="http://www.php.net/manual/en/stream.streamwrapper.example-1.php">PHP</a> (I thought it was only available with a C extension). It's pretty straightforward to create the wrapper. Of course it's only an approach. We can create more functionality to our stram wrapper but at least this example meets my needs.
</blockquote>
<p>
His wrapper uses a client from his <a href="http://code.google.com/p/nov-framework/">Nov</a> framework to open the stream to the given path and gives read and write methods to work with the data inside the database. Code for the wrapper class is included as well as a bit of example code showing how it can be used with the custom stream protocol. You can find the complete code <a href="http://code.google.com/p/nov-framework/">here</a>.
</p>]]></description>
      <pubDate>Thu, 28 Apr 2011 10:45:27 -0500</pubDate>
    </item>
  </channel>
</rss>

