<?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, 22 May 2012 12:03:12 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPMaster.com: Maintaining your Server with Command Line PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17825</guid>
      <link>http://www.phpdeveloper.org/news/17825</link>
      <description><![CDATA[<p>
<i>Stephen Thorpe</i> has a new article posted on the PHPMaster.com site today about <a href="http://phpmaster.com/maintaining-your-server-with-command-line-php/">using command line PHP</a> to handle some of the automation on your server.
</p>
<blockquote>
n this article we'll look at the advantages of using PHP CLI. I'll show you how to test PHP's Command Line Interface / Interpreter (CLI) on your server, and then we'll look at some of the options available for PHP CLI including the interactive shell and how to create executable scripts. Finally, I'll give you a couple of examples of scripts to use to maintain your server written in PHP.
</blockquote>
<p>
He introduces the command-line executable for PHP and shows how to use it to create some simple scripts (including ones that take in command-line arguments). He shows how to make a simple script to monitor disk usage (using the unix command "df") and a backup script that copies files/folders over to another device.
</p>]]></description>
      <pubDate>Tue, 17 Apr 2012 09:37:16 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Odafe Ojenikoh's Blog: Interactive PHP CLI Applications using Zend Form]]></title>
      <guid>http://www.phpdeveloper.org/news/17552</guid>
      <link>http://www.phpdeveloper.org/news/17552</link>
      <description><![CDATA[<p>
<i>Odafe Ojenikoh</i> has submitted a post he's written up showing how to <a href="http://blog.ojenikoh.com/2012/02/14/interactive-php-cli-applications-using-zend-form/">create a command line PHP application</a> with the help of the Zend Framework and it's Zend_Form elements.
</p>
<blockquote>
Over the weekend, I was toying with the idea of interactive cli applications using readline() and Zend Form for validating input. My motivation for using Zend Form or rather Zend Form elements was to exploit the power of features such as labels, validators, filters and the prospect of reusing forms within web application code.
</blockquote>
<p>
His example code defines a Filter for the form errors (returning them as a string) and a "Cli" class that handles the interaction with the command line. Next up is a class defining the form elements - a prompt for a color name and either of the words "thank" and "you". The Cli class transforms the form elements into prompts on the command line and lets you define validators to check their input.
</p>]]></description>
      <pubDate>Thu, 16 Feb 2012 11:09:57 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Justin Carmony's Blog: SMS Nagios Notifications with PHP & Twilio]]></title>
      <guid>http://www.phpdeveloper.org/news/17473</guid>
      <link>http://www.phpdeveloper.org/news/17473</link>
      <description><![CDATA[<p>
In <a href="http://www.justincarmony.com/blog/2012/01/30/sms-nagios-notifications-with-php-twilio/">this latest post</a> to his blog <i>Justin Carmony</i> looks at a system he created to hook his Nagios notifications into the <a href="http://www.twilio.com/">Twilio</a> web service and have it notify him via SMS with something was wrong.
</p>
<blockquote>
In the past I would just use my iPhone's email-to-txt email address. However, when I received the txt message, it wasn't formated very pretty, and it would have a different "From Number." So if we had a crazy day, I would have 20-30 message threads in my iPhone all about Nagios. [...] What I like out this setup is with Twilio, I can buy a phone number for $1 a month. So all my notifications come through the same number.
</blockquote>
<p>
He's <a href="https://github.com/JustinCarmonyDotCom/Nagios-SMS-Requests-with-PHP-Twilio">included the PHP code</a> he uses to send the notifications (using the Twillo library) and the Nagios commands he configured to send the notifications to that script via the command line.
</p>]]></description>
      <pubDate>Tue, 31 Jan 2012 12:40:46 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Gonzalo Ayuso's Blog: Building a small microframework with PHP (Part 2). Command line interface]]></title>
      <guid>http://www.phpdeveloper.org/news/16786</guid>
      <link>http://www.phpdeveloper.org/news/16786</link>
      <description><![CDATA[<p>
Continuing on with his <a href="http://phpdeveloper.org/news/16756">previous investigations</a> into microframworks and what it takes to create them, <i>Gonzalo Ayuso</i> has <a href="http://gonzalo123.wordpress.com/2011/08/29/building-a-small-microframework-with-php-part-2-command-line-interface/">posted his second part</a> of the series - a look at working on the command line.
</p>
<blockquote>
In my last post we spoke about building a small microframework with PHP. The main goal of this kind of framework was to be able to map urls to plain PHP classes and become those classes easily testeable with PHPUnit. Now we're going to take a step forward. [...] It's pretty straightforward to create a command line interface (CLI) for our microframework. 
</blockquote>
<p>
He shows how to use the <a href="http://php.net/getopt">getopt</a> function and the $GLOBALS superglobal to pull in arguments given to the command line script. He hooks this into the framework and makes it possible to define the controller and action to execute (with a few examples to show it in action). You can find this updated code on <a href="https://github.com/gonzalo123/microFramework">his github account</a>.
</p>]]></description>
      <pubDate>Mon, 29 Aug 2011 13:19:11 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Maarten Balliauw's Blog: A hidden gem in the Windows Azure SDK for PHP: command line parsing]]></title>
      <guid>http://www.phpdeveloper.org/news/16575</guid>
      <link>http://www.phpdeveloper.org/news/16575</link>
      <description><![CDATA[<p>
In <a href="http://blog.maartenballiauw.be/post/2011/07/11/A-hidden-gem-in-the-Windows-Azure-SDK-for-PHP-command-line-parsing.aspx">this new post</a> <i>Maarten Balliauw</i> looks at a "hidden gem" in the Windows Azure SDK for PHP - the ability to create scripts to work with command-line scripts - the Microsoft_Console_Command class.
</p>
<blockquote>
Usually when creating a command line script you would parse $_SERVER['argv'], validate values and check whether required switches are available or not. With the Microsoft_Console_Command class from the <a href="http://download.codeplex.com/Project/Download/SourceControlFileDownload.ashx?ProjectName=phpazure&changeSetId=63811">Windows Azure SDK</a> for PHP, you can ease up this task. Let's compare writing a simple "hello" command.
</blockquote>
<p>
He compares the two sides of making a PHP command-line script: the "ugly way" using normal PHP code and $_SERVER['argv'] and the "easy way" using the Microsoft_Console_Command class that uses a class to define the functionality. There's also methods to grab specific arguments, pull from STDIN and get environment variables.
</p>]]></description>
      <pubDate>Mon, 11 Jul 2011 11:41:38 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Zend Developer Zone: Getting an OAuth Access Token from the Command Line]]></title>
      <guid>http://www.phpdeveloper.org/news/16448</guid>
      <link>http://www.phpdeveloper.org/news/16448</link>
      <description><![CDATA[<p>
<i>Tim Lytle</i> has written up a <a href="http://devzone.zend.com/article/15363-Getting-an-OAuth-Access-Token-from-the-Command-Line">new tutorial</a> for the Zend Developer Zone talking about OAuth and making one of the more difficult parts - getting an access token - a bit simpler using a command-line application.
</p>
<blockquote>
OAuth is great - there's no need to save users' passwords, it's - in theory - a consistent way to interact with other services, and it's hopefully something that your users are familiar and comfortable using. But if you're not just interacting with your users' accounts - for example, your application uses a single account on a service to broadcast messages, or analyze data - getting or renewing the access token can be painful.
</blockquote>
<p>
He illustrates the problem with an example connecting to Twitter and even <a href="https://gist.github.com/407858">points out a script</a> that makes bridging this gap simpler. Unfortunately, it's not exactly what he needed, so he reworked the idea with a call to the Twitter API using a Zend_Oauth_Consumer and a custom callback. The script is then set up with some command line options for inputting the key and secret information. Also included is functionality letting you define a configuration file. You can see the final result <a href="https://gist.github.com/1014769">here on github</a>.
</p>]]></description>
      <pubDate>Thu, 09 Jun 2011 11:04:29 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[JavaWorld: Web-less PHP: Command Line PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/16408</guid>
      <link>http://www.phpdeveloper.org/news/16408</link>
      <description><![CDATA[<p>
On JavaWorld they've posted a look at <a href="http://www.javaworld.com/community/?q=node/7715">command-line PHP support</a> including a few sample scripts to get you started:
</p>
<blockquote>
When I decided to <a href="http://marxsoftware.blogspot.com/2011/04/why-php-will-be-my-next-language.html">give PHP a closer look</a>, I wondered if PHP was a browser-only technology or if it could be used for command line scripting. It turns out that one can write operating system level scripts with PHP as discussed in online resources such as <a href="http://www.macronimous.com/resources/Command_Line_Scripting_in_PHP.asp">Command Line Scripting in PHP</a>, <a href="http://www.php.net/manual/en/install.windows.commandline.php">Command Line PHP on Microsoft Windows</a>, and <a href="http://www.php.net/manual/en/features.commandline.usage.php">Executing PHP</a> files. In this blog post, I look at PHP command line scripting at an introductory level.
</blockquote>
<p>
He talks about some of the basics - setting up a "Hello World" script to be run as PHP (and running it) as well as adding in the ability to take command-line arguments. He shows how to get environment information and run other command calls through the PHP script. He also points out the handy <a href="http://php.net/php_sapi_name">php_sapi_name</a> method that can be used to detect whether or not the script is running on the command line.
</p>]]></description>
      <pubDate>Tue, 31 May 2011 13:09:05 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Maarten Balliauw's Blog: Windows Azure and scaling: how?]]></title>
      <guid>http://www.phpdeveloper.org/news/16096</guid>
      <link>http://www.phpdeveloper.org/news/16096</link>
      <description><![CDATA[<p>
In a recent post to his blog <i>Maarten Balliauw</i> (the third part of a series) looks at how you can <a href="http://blog.maartenballiauw.be/post/2011/03/24/Windows-Azure-and-scaling-how-(PHP).aspx">use Azure to scale</a> your PHP-based application dynamically using the latest version of the <a href="http://phpazure.codeplex.com/SourceControl/list/changesets">Windows Azure SDK for PHP</a>. His example creates a simple shell script that can scale up or down your instances with one call.
</p>
<blockquote>
One of the key ideas behind cloud computing is the concept of scaling.Talking to customers and cloud enthusiasts, many people seem to be unaware about the fact that there is great opportunity in scaling, even for small applications. 
</blockquote>
<p>
Using <a href="http://phpazure.codeplex.com/SourceControl/list/changesets">the SDK</a>, he shows how to create the command-line tool buy craeting a management client and setting up the command line parameters to give to the setInstanceCountBySlot() method. This gives you the ability to spawn off as many new "slots" (instances) as you might need quickly and easily.
</p>]]></description>
      <pubDate>Thu, 24 Mar 2011 12:10:17 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Stuart Herbert's Blog: Introducing phix]]></title>
      <guid>http://www.phpdeveloper.org/news/16071</guid>
      <link>http://www.phpdeveloper.org/news/16071</link>
      <description><![CDATA[<p>
In a new post to his blog <i>Stuart Herbert</i> has <a href="http://blog.stuartherbert.com/php/2011/03/21/introducing-phix/">introduced phix</a>, a packaging tools that can be used to manage and install different components in a framework-agnostic sort of way.
</p>
<blockquote>
<a href="http://github.com/Gradwell/phix">phix</a> is a small command-line tool for PHP applications. I created it to fix (pun intended) the problem of how to easily automate the tasks involved in creating and (especially) maintaining components. These tasks aren't built into phix; they are commands that ship with the phix distribution. You can create your own commands to run inside phix too, and it's easy to do so
</blockquote>
<p>
The <a href="http://github.com/Gradwell/phix">phix</a> tool (easily installed from PEAR) lets you either use built-in commands or custom ones to manage libraries with a few different kinds of commands - current status, initialize a library, upgrade a library and manage the full web application. As of the time of this post, the current version is <a href="http://github.com/Gradwell/phix">phix-0.10.4</a>.
</p>]]></description>
      <pubDate>Mon, 21 Mar 2011 08:24:05 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[FuelPHP: Oil Migrations, Tasks and Console (Screencast)]]></title>
      <guid>http://www.phpdeveloper.org/news/16046</guid>
      <link>http://www.phpdeveloper.org/news/16046</link>
      <description><![CDATA[<p>
<i>Phil Sturgeon</i> has <a href="http://blip.tv/file/4885416">put together a screencast</a> showing off a few of the features of the <a href="http://fuelphp.com">Fuel PHP framework</a> like migrations, tasks and the console the Oil tool provides.
</p>
<blockquote>
In this video I'm going to be demonstrating migrations which I touched on in the last video but I felt I should go into them in more depth. Migrations [...] are essentially a way to stage changes for your database in a way that means the changes can be independent from the schema as a whole.
</blockquote>
<p>
He walks you through the creation of a migration with the help of the Oil command line tool. The generated classes include "up" and "down" methods for the creation and rollback of your changes. He shows the process to create a simple task and how to use the built-in console to interactively work with the framework. You can find out more about Fuel <a href="http://fuelphp.com/docs/">on the Fuel documentation section</a> of the project's site.
</p>]]></description>
      <pubDate>Tue, 15 Mar 2011 11:31:39 -0500</pubDate>
    </item>
  </channel>
</rss>

