<?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, 19 May 2013 10:57:10 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Josh Adell's Blog: Command Invoker Pattern with the Open/Closed Principle]]></title>
      <guid>http://www.phpdeveloper.org/news/17398</guid>
      <link>http://www.phpdeveloper.org/news/17398</link>
      <description><![CDATA[<p>
In a response to a <a href="http://phpdeveloper.org/news/17389">recent post</a> on DZone.com about the "Open/Closed Principle" <i>Josh Adell</i> has <a href="http://blog.everymansoftware.com/2012/01/command-invoker-pattern-with-openclosed.html">posted an example</a> of a " flexible and extendable command invocation solution" implementing this <a href="http://en.wikipedia.org/wiki/SOLID_(object-oriented_design)">SOLID</a> idea.
</p>
<blockquote>
Let's overcome some of these issues [with only being able to extend the invoker class and that the invoker needs to know how to create commands], and also make the code even more extensible. I'll use a simplified command invoker to demonstrate.
</blockquote>
<p>
His code is included - the creation of a "Command" interface and two comments that implement it: "HelloCommand" and "PwdCommand", each with "register" and "execute" methods. His "Invoker" class then only needs to be told how to map these commands and the "register" is called as they're needed. You can find the full example code for this invocation example <a href="http://gist.github.com/1610148">in this gist</a>.
</p>]]></description>
      <pubDate>Mon, 16 Jan 2012 10:04:42 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DZone.com: Open/Closed Principle on real world code]]></title>
      <guid>http://www.phpdeveloper.org/news/17389</guid>
      <link>http://www.phpdeveloper.org/news/17389</link>
      <description><![CDATA[<p>
In a new post to DZone.com <i>Giorgio Sironi</i> talks about the "open/closed principle" in software development and shows an example based on the design of the <a href="https://github.com/giorgiosironi/phpunit-selenium">PHPUnit_Selenium</a> project.
</p>
<blockquote>
This article shows an example of how the application of the Open/Closed Principle improved the design of a real project, the open source library <a href="https://github.com/giorgiosironi/phpunit-selenium">PHPUnit_Selenium</a>. These design concepts apply to every object-oriented language, including Java, Ruby or even C++. The <a href="http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod">Open Closed Principle</a>, part of SOLID set, states that software should be open for extension and at the same time closed for modification.
</blockquote>
<p>
He starts with a little background on the project, pointing out that there's a Session object it uses for all of its testing with a magic "__call" method that handles any kind of method call to the object. This method has issues (dependencies, strict requirements for use) but can be refactored according to the Open/Closed idea to set up an array of anonymous functions that can be called as a "command". Examples of these types of classes are also included (one for the "click" action on a button and another for getting the current location).
</p>]]></description>
      <pubDate>Fri, 13 Jan 2012 09:05:53 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Understanding the Command Design Pattern]]></title>
      <guid>http://www.phpdeveloper.org/news/17335</guid>
      <link>http://www.phpdeveloper.org/news/17335</link>
      <description><![CDATA[<p>
On PHPMaster.com today there's a new article introducing you to the Command design pattern and looking to help you <a href="http://phpmaster.com/understanding-the-command-design-pattern">understand its use a bit better</a>.
</p>
<blockquote>
The majority of [cell phone] users have opted to receive an email, but a significant number are now opting to receive the notifications via SMS. Here's the problem: How do you send a message via two different channels to both groups of users? The logical approach would be to split the users into 2 groups, email recipients and SMS recipients, which would involve running 2 different queries and sending the codeword to each group separately. Using the Command Pattern, which I will introduce you to in this article, you can send the message to both groups of users in a single process.
</blockquote>
<p>
He uses the message queue he mentioned as an example - showing how you can can queue up different kinds of objects (actions) based on a common interface into the same process. He creates a "DailyAlertEmail" and "DailyAlertSMS" classes, both with a "send" method. The settings for these are then pulled from a database and the "execute" method on the "MessageQueue" class is called to loop through them, calling "send" to do that work.
</p>]]></description>
      <pubDate>Tue, 03 Jan 2012 08:25:29 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Sanitizing Input with PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17250</guid>
      <link>http://www.phpdeveloper.org/news/17250</link>
      <description><![CDATA[<p>
DevShed.com has a new tutorial posted today looking at <a href="http://www.devshed.com/c/a/PHP/Sanitizing-Input-with-PHP/">how to sanitize data in your application</a>, specifically data coming from the user, when calling shell commands.
</p>
<blockquote>
Neglecting to sanitize user input that may subsequently be passed to system-level functions could allow attackers to do massive internal damage to your information store and operating system, deface or delete Web files, and otherwise gain unrestricted access to your server. And that's only the beginning.
</blockquote>
<p>
He starts with a "real world" example of non-filtered data that could pass through a "rm" command and erase your entire drive. He offers two solutions for preventing this sort of hack using the <a href="http://php.net/escapeshellcmd">escapeshellcmd</a> and <a href="http://php.net/escapeshellarg">escapeshellarg</a> functions.
</p>]]></description>
      <pubDate>Tue, 13 Dec 2011 11:49:31 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[James Morris' Blog: A Symfony2 Console Command and the Foursquare API Venuehistory]]></title>
      <guid>http://www.phpdeveloper.org/news/16813</guid>
      <link>http://www.phpdeveloper.org/news/16813</link>
      <description><![CDATA[<p>
In a new post to his blog <i>James Morris</i> has <a href="http://blog.jmoz.co.uk/symfony2-command-foursquare-api">shared a custom Symfony2 console command</a> he's written to pull in Foursquare data for his testing locally.
</p>
<blockquote>
I've been playing with the Foursquare API recently, I'm attempting to get a new homepage built and want to display a map of where I hang out. I use Foursquare quite a bit so wanted to get the locations from their API then plot them on Google maps. There's a <a href="https://developer.foursquare.com/docs/users/venuehistory.html">venuehistory endpoint</a> that gives you a massive list of all the venues you've checked into with details such as the venue name, location including lat and lng coordinates, and the count of times you've checked in.
</blockquote>
<p>
He includes <a href="http://posterous.com/getfile/files.posterous.com/jmoz/ejqtAckwmaDfjxHECcarAxGeqrHIklJlmtbrxlogdjskygzCletjbsdIzfJm/media_httpdldropboxco_GDpci.png.scaled1000.png">a screenshot</a> of the API's results, the code you'll need to recreate it and <a href="http://posterous.com/getfile/files.posterous.com/jmoz/aHoxvDdodwFtkDltlnBkciufBoHbmHJeqckeBGDnssufAEhyCApnhzHyJkev/media_httpdldropboxco_rkCdq.png.scaled1000.png">an example of it running</a>.
</p>]]></description>
      <pubDate>Mon, 05 Sep 2011 09:54:40 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Gonzalo Ayuso's Blog: My VIM configuration for PHP development]]></title>
      <guid>http://www.phpdeveloper.org/news/15672</guid>
      <link>http://www.phpdeveloper.org/news/15672</link>
      <description><![CDATA[<p>
In a search for his perfect development environment (note "his" not "the") <i>Gonzalo Ayuso</i> has <a href="http://gonzalo123.wordpress.com/2011/01/03/my-vim-configuration-for-php-developement/">taken another look at vim</a> in a new post to his blog with some handy plugins and commands he's found so far.
</p>
<blockquote>
Keeping on with my continuous search for the perfect IDE I've resumed my fight against VIM. As someone told me the learning of vim is a road of pain. It's something like going to the gym. We known that going to the gym is good and healthy but it's hard and painfully especially at the beginning. The learning curve of vim is hard. [...] VIM is not my default IDE yet. I hope to swap to VIM soon but I feel myself slower when I code comparing with Netbeans or ZendStudio, and slow means less productive but I also feel if invest more time vim can be really productive. 
</blockquote>
<p>He points out these plugins and commands:</p>
<ul>
<li><a href="http://www.vim.org/scripts/script.php?script_id=1658">NerdTree</a>
<li>the "buffer explorer"
<li>using <a href="http://code.google.com/p/zen-coding/wiki/ZenHTMLSelectorsEn">Zen Coding</a>
<li>using the debugger (along with <a href="http://xdebug.de">XDebug</a>)
<li><a href="http://www.vim.org/scripts/script.php?script_id=2540">snipMate</a>
<li>using omni completion
<li>supertab
<li>and a few more various, useful commands...
</ul>]]></description>
      <pubDate>Mon, 03 Jan 2011 13:50:35 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Web Builder Zone: Real-life closures examples...for real]]></title>
      <guid>http://www.phpdeveloper.org/news/15594</guid>
      <link>http://www.phpdeveloper.org/news/15594</link>
      <description><![CDATA[<p>
On the Web Builder Zone (from DZone.com) <i>Giorgio Sironi</i> has <a href="http://css.dzone.com/articles/real-life-closures-examples">a new post about closures</a> with some real life examples...no really, real ones.
</p>
<blockquote>
I wrote <a href="http://giorgiosironi.blogspot.com/2010/02/stop-writing-foreach-cycles.html">an article</a> long time ago about array_map(), array_filter(), and they are very handy in some cases, but I discovered there is a catch: they do their best when you already have a defined function to pass them. [...] So here's my real real-life example for closures: in my opinion, they are not meant for substituting foreach(), but for example to pass a curried callback method around (an implementation of the Command pattern).
</blockquote>
<p>
His implementation uses the <a href="http://en.wikipedia.org/wiki/Command_pattern">Command design pattern</a> to create both Car and Truck objects that can use the Pump object for their tirePressure.
</p>]]></description>
      <pubDate>Fri, 17 Dec 2010 08:19:07 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[ServerGrove.com: Creating console commands with Symfony2]]></title>
      <guid>http://www.phpdeveloper.org/news/15285</guid>
      <link>http://www.phpdeveloper.org/news/15285</link>
      <description><![CDATA[<p>
On the ServerGrove.com blog today there's <a href="http://blog.servergrove.com/2010/10/14/creating-console-commands-with-symfony2/">this new post</a> showing you how to create console commands with your <a href="http://symfony-reloaded.org/">Symfony2</a> codebase in addition to the normal websites you might have generated.
</p>
<blockquote>
<a href="http://symfony-reloaded.org/">Symfony 2</a> is mainly used to create web application, however, sometimes you need to extend your app and need a command line tool to help perform tasks around the application. With <a href="http://www.symfony-project.org/">symfony 1.4.x</a> these were called <a href="http://www.symfony-project.org/gentle-introduction/1_4/en/16-Application-Management-Tools#chapter_16_sub_custom_tasks">tasks</a> and it was possible to create a skeleton by using the symfony generate:task task.
</blockquote>
<p>
While there's not a tool for it, Symfony2 does offer something called "Commands" as a sort of replacement. A basic skeleton of one is included with the framework, there's just no auto-generation tool for them (yet). The basic one, TestCommand.php, shows you how to set up a command's name, arguments and some parameter mapping. <a href="http://blog.servergrove.com/2010/10/14/creating-console-commands-with-symfony2/">The post</a> includes this code example and how it looks when called from the command line.
</p>
]]></description>
      <pubDate>Fri, 15 Oct 2010 08:53:19 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPBuilder.com: Mitigate the Security Risks of PHP System Command Execution]]></title>
      <guid>http://www.phpdeveloper.org/news/13934</guid>
      <link>http://www.phpdeveloper.org/news/13934</link>
      <description><![CDATA[<p>
PHPBuilder.com has a new article from <i>Jason Gilmore</i> on <a href="http://www.phpbuilder.com/columns/Jason_Gilmore012810.php3">security in command-line applications</a> posted today and what you can do to help protect your scripts from unwanted system command access.
</p>
<blockquote>
In this tutorial, I'll show you how to securely execute a variety of system-based commands via a PHP script, demonstrating how to build web applications that can tightly integrate with both the operating system and third-party software.
</blockquote>
<p>
He mentions the proper filtering of input strings (user input), how it can protect your and your application as well as a few examples of using the PHP execution functions (like <a href="http://php.net/exec">exec</a> or <a href="http://php.net/passthru">passthru</a>) and how to apply the shell escaping commands (like <a href="http://www.php.net/escapeshellarg">escapeshellarg</a>) as a first layer of security.
</p>]]></description>
      <pubDate>Fri, 29 Jan 2010 09:47:19 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Solar Blog: Solar CLI - Make-Model]]></title>
      <guid>http://www.phpdeveloper.org/news/12114</guid>
      <link>http://www.phpdeveloper.org/news/12114</link>
      <description><![CDATA[<p>
The Solar blog has been updated <a href="http://solarphp.com/blog/read/29-solar-cli-make-model">this a new post</a> continuing on the look at the Solar CLI (started <a href="http://solarphp.com/blog/read/27-solar-cli-getting-started">here</a>) and its "make-model" command.
</p>
<blockquote>
This entry is a <a href="http://solarphp.com/blog/read/27-solar-cli-getting-started">continuation</a> of the Solar CLI series--a series that aims to detail Solar CLI commands, available options, parameters, and usage examples. In this entry we take a look at make-model, a command that can generate models based on a SQL table.
</blockquote>
<p>
<a href="http://solarphp.com/blog/read/29-solar-cli-make-model">The post</a> goes through the available options and parameters that you can give the command to make things easier and includes an example of running the "make-model" on a table in a MySQL database (with the code to add to your Solar configuration file to match).
</p>]]></description>
      <pubDate>Wed, 11 Mar 2009 11:12:27 -0500</pubDate>
    </item>
  </channel>
</rss>
