<?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>Sat, 18 May 2013 21:55:01 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[NetTuts.com: Reflection in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/19484</guid>
      <link>http://www.phpdeveloper.org/news/19484</link>
      <description><![CDATA[<p>
On NetTuts.com today there's a new tutorial talking about a part of PHP that can be quite powerful but isn't used too often - <a href="http://net.tutsplus.com/tutorials/php/reflection-in-php/">reflection in PHP</a>. Using Reflection you can get information about your actual code and its elements without having to try to parse it yourself.
</p>
<blockquote>
Reflection is generally defined as a program's ability to inspect itself and modify its logic at execution time. In less technical terms, reflection is asking an object to tell you about its properties and methods, and altering those members (even private ones). In this lesson, we'll dig into how this is accomplished, and when it might prove useful.
</blockquote>
<p>
They provide a little context around the idea of "reflection" in programming languages and then jump right in with a few sample classes. They set up their "Nettuts", "Manager" and "Editor" classes and show how to use the <a href="http://php.net/reflectionclass">ReflectionClass</a> functionality to get their structure. The examples show how to get the class' methods, their properties and calling these methods using things like <a href="http://php.net/manual/en/reflectionmethod.invoke.php">invoke</a> and <a href="http://php.net/call_user_func">call_user_func</a>.
</p>
Link: http://net.tutsplus.com/tutorials/php/reflection-in-php]]></description>
      <pubDate>Fri, 19 Apr 2013 10:24:28 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Lorna Mitchell: 9 Magic Methods in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/18875</guid>
      <link>http://www.phpdeveloper.org/news/18875</link>
      <description><![CDATA[<p>
<i>Lorna Mitchell</i> has a new post showing <a href="http://www.lornajane.net/posts/2012/9-magic-methods-in-php">nine of the magic methods</a> that are included in PHP by default (like __construct, __get and __set) including a few you may not have used before.
</p>
<blockquote>
The <A href="http://php.net/manual/en/language.oop5.magic.php">"magic" methods</a> are ones with special names, starting with two underscores, which denote methods which will be triggered in response to particular PHP events. That might sound slightly automagical but actually it's pretty straightforward, we already saw an example of this in the last post, where we used a constructor - so we'll use this as our first example.
</blockquote>
<p>She includes details (and some code samples) for these methods:</p>
<ul>
<li>__construct
<li>__destruct
<li>__get
<li>__set
<li>__call
<li>__sleep
<li>__wakeup
<li>__clone
<li>__toString
</ul>
<p>
You can find out about these and a few others in <a href="http://php.net/manual/en/language.oop5.magic.php">this page</a> of the PHP manual.
</p>]]></description>
      <pubDate>Tue, 11 Dec 2012 12:18:49 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Reddit.com: Avoid static methods at all costs? (testability)]]></title>
      <guid>http://www.phpdeveloper.org/news/18523</guid>
      <link>http://www.phpdeveloper.org/news/18523</link>
      <description><![CDATA[<p>
On Reddit.com there's <a href="http://www.reddit.com/r/PHP/comments/10hank/avoid_static_methods_at_all_costs_testability/">a recent post</a> questioning the (recently) common saying that PHP developers should avoid static methods when concerned about testability:
</p>
<blockquote>
I get it: testing is important, and building your codebase in a manner that is easy to test should be a priority. However, sometimes I feel like I have to compromise on the elegance of my code in order to maintain testability. Cases where perhaps a static method makes sense, but end up having to perform some coding acrobatics in order to avoid it. Is this a common challenge, something many developers face and must balance between? Or am I misguided in how frequently static methods can be the most elegant solution (before taking testability into consideration)?
</blockquote>
<p>
<a href="http://www.reddit.com/r/PHP/comments/10hank/avoid_static_methods_at_all_costs_testability/#comments">Answers</a> point out a few things - that sometimes, state doesn't matter and static is okay or that they can be used if the instance they return is always exactly the same, never altered.
</p>]]></description>
      <pubDate>Wed, 26 Sep 2012 11:59:04 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Volker Dusch's Blog: An introduction to PHPUnits @covers annotation]]></title>
      <guid>http://www.phpdeveloper.org/news/17085</guid>
      <link>http://www.phpdeveloper.org/news/17085</link>
      <description><![CDATA[<p>
<a href="http://phpunit.de">PHPUnit</a> is one of the most widely used unit testing tools for PHP applications. It comes packed with features, some that are commonly used and some not so much. In <a href="http://edorian.posterous.com/an-introduction-to-phpunits-covers-annotation">a new post to his blog</a> today <i>Volker Dusch</i> looks at one specific feature - the "@covers" annotation you can use in your tests' comments to specify which functionality you're actually testing.
</p>
<blockquote>
One of the goals of your test suite and the coverage report is to make you trust in your code base and to remove the fear of changing something that needs to be changed. [...] You shouldn't think "Well yes that a 100% but a lot of that just comes from that big integration test and I don't know if the class is really tested!". [...] Thankfully PHPUnit offers a way to drastically increase your confidence in what you actually have tested.
</blockquote>
<p>
Using the "@covers" annotation on your test method docblocks gives you one more level of confidence in what's being tested and can help make for clearer updating down the road. He also mentions using them to provide extra insight into protected methods in your code and where the test coverage for them really lies.
</p>]]></description>
      <pubDate>Fri, 04 Nov 2011 09:55:32 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Alexander Netkachev's Blog: Practical PHP events]]></title>
      <guid>http://www.phpdeveloper.org/news/6559</guid>
      <link>http://www.phpdeveloper.org/news/6559</link>
      <description><![CDATA[<p>
In his <a href="http://www.alexatnet.com/Blog/Index/2006-10-24/practical-php-events">latest tutorial</a>, <i>Alexander Netkachev</i> shows how to, with some of the simple PHP functions, create an event system for your script, complete with callbacks.
</p>
<blockquote>
The way how events are raised and how listeners are attached on the events is a part of a core in many modern applications. It plays an important role in some enterprise design patterns (MVC, for example). 
</blockquote>
<p>
He starts with the basics of event handling - some of the terms and descriptions of basic functionality that any good event handler would have. He describes the most common setup of an event-interaction relationship. Then, it's on to the code, showing first three different ways to call functions (by name, by variable, and by callback).
</p>
<p>
He <a href="http://www.alexatnet.com/Blog/Index/2006-10-24/practical-php-events">finishes it off</a> with a functional example that responds to a a call to fireEvent (five times) and handles each by calling the function in the callback information (myFunction).
</p>]]></description>
      <pubDate>Tue, 24 Oct 2006 07:20:48 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Finding Paths, Timestamps and More with the DirectoryIterator Class in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/6295</guid>
      <link>http://www.phpdeveloper.org/news/6295</link>
      <description><![CDATA[<p>
DevShed continues its look at the DirectoryIterator functionality in PHP5 with <a href="http://www.devshed.com/c/a/PHP/Finding-Paths-Timestamps-and-More-with-the-DirectoryIterator-Class-in-PHP/">the second part of the series</a> today - "Finding Paths, Timestamps and More with the DirectoryIterator Class in PHP".
</p>
<blockquote>
Are you interested in having at your disposal a quick reference for working with the "DirectoryIterator" class that comes with PHP 5? Then this might be the article that you've been waiting for! Welcome to the second tutorial of the series "A Close Look at the DirectoryIterator Class in PHP 5." Over the course of this set of installments, you'll find complete coverage of the most important methods bundled with this class, and learn how to take advantage of their excellent functionality.
</blockquote>
<p>
They <a href="http://www.devshed.com/c/a/PHP/Finding-Paths-Timestamps-and-More-with-the-DirectoryIterator-Class-in-PHP/">cover even more functions</a> in this part:
<ul>
<li>rewind, current, valid
<li>getFileName, isFile
<li>getMTime, getATime, getCTime
<li>getPath, getPathName
</ul>
Each set is supported by code and explaination to help introduce their concepts in a useful way.
</p>]]></description>
      <pubDate>Mon, 18 Sep 2006 08:21:51 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Classes as PHP Functions]]></title>
      <guid>http://www.phpdeveloper.org/news/5985</guid>
      <link>http://www.phpdeveloper.org/news/5985</link>
      <description><![CDATA[<p>
Continuing on in their "PHP functions" series today, DevShed has posted <a href="http://www.devshed.com/c/a/PHP/Classes-as-PHP-Functions/">this next step</a> up the ladder, getting more advanced with the functions they're working with. This time, there's a focus on functions inside classes and creating the classes around them (a sort of introduction to object-oriented programming).
</p>
<blockquote>
Continuing our PHP functions article, we move on to creating classes. Let me say right at the start that you can write perfectly effective and useful PHP code without creating classes or going into object oriented programming. Object oriented programming can be very powerful and PHP programmers are increasingly taking advantage of these capabilities, which have been greatly expanded since PHP4.
</blockquote>
<p>
They <a href="http://www.devshed.com/c/a/PHP/Classes-as-PHP-Functions/">start with the creation</a> of a simple class - a human class with two $legs and two $arms. They show a simple display of this data and add another attribute to the class, one for hair color. They then capture the output they've been creating inside a function, report, and show how to execute it. Finally, they show how to use the special function that runs when the object is created - the constructor.
</p>]]></description>
      <pubDate>Wed, 09 Aug 2006 05:49:25 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Implementing Additional Methods with mysqli and PHP 5]]></title>
      <guid>http://www.phpdeveloper.org/news/5762</guid>
      <link>http://www.phpdeveloper.org/news/5762</link>
      <description><![CDATA[<p>
DevShed has posted <a href="http://www.devshed.com/c/a/MySQL/Implementing-Additional-Methods-with-mysqli-and-PHP-5/">part three</a> of their popular "using mysqli in PHP5" series today, this time, they focus on increasing the functionality of the code they started <a href="http://www.phpdeveloper.org/news/5750">last time</a> with other mysqli methods.
</p>
<blockquote>
I must say that the "mysqli" extension offers an impressive set of features, which can be implemented right from the very beginning. However, and speaking of its cool features, in the next few lines, I'm going to show you a few more. Over the course of this last tutorial, I'll be covering some other methods and properties, mainly aimed at finding the IDs after inserting new rows, and obtaining information about specific table fields.
</blockquote>
<p>
They <a href="http://www.devshed.com/c/a/MySQL/Implementing-Additional-Methods-with-mysqli-and-PHP-5/">touch on</a> the fetch_array, data_seek, fetch_assoc, fetch_field, and fetch_seek functions, giving examples and other assicated properties along the way. 
</p>]]></description>
      <pubDate>Mon, 10 Jul 2006 07:22:54 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Ben Ramsey's Blog: Add Children with SimpleXML]]></title>
      <guid>http://www.phpdeveloper.org/news/5355</guid>
      <link>http://www.phpdeveloper.org/news/5355</link>
      <description><![CDATA[<p>
In <a href="http://benramsey.com/archives/add-children-with-simplexml/">this new post</a> on <i>Ben Ramsey<i/>'s blog today, he shares his experiences with SimpleXML, mentioning specifically some of the undocumented functions that he's noticed.
</p>
<quote>
<i>
I was very excited today while glancing through the code in <a href="http://cvs.php.net/viewcvs.cgi/php-src/ext/simplexml/simplexml.c?view=markup">ext/simplexml/simplexml.c</a> to find some, as of yet, undocumented methods in PHP's <a href="http://www.php.net/SimpleXML">SimpleXMLElement</a> class. This discovery came after I've spent several hours over the last couple of nights banging my head against the desk to figure out a way to create a class that extends SimpleXMLElement and adds a new method for adding a child, which would have to use DOM in order to work-or so I thought.
</i>
</quote>
<p>
Of course, it's wasn't as <a href="http://benramsey.com/archives/add-children-with-simplexml/">easy as it seemed</a>, and <i>Ben</i> soon found some of the limitations of the SimpleXML library. Of course, he did manage to find a way to add new children to the document you're working with (something that normally would have required the intervention of the DOM functionality). Check out <a href="http://benramsey.com/archives/add-children-with-simplexml/">the post</a> for a code example.
</p>]]></description>
      <pubDate>Thu, 11 May 2006 20:03:57 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Mike Naberezny's Blog: pecl/operator and Other Neat Stuff]]></title>
      <guid>http://www.phpdeveloper.org/news/4780</guid>
      <link>http://www.phpdeveloper.org/news/4780</link>
      <description><![CDATA[<i>Mike Naberezny</i> has <a href="http://www.mikenaberezny.com/archives/39">this new post</a> on his blog today about the latest extension submitted by <a href="http://pecl.php.net/user/pollita">Sara Golemon</a> to the PECL library - the <a href="http://pecl.php.net/package/operator">pecl/operator</a> extension.
<p>
<quote>
<i>

This extension adds operator overloading support to PHP 5. I don't think operator overloading fits the "PHP spirit" and as such I speculate it probably won't ever make it into the core. Regardless, it's interesting that this extension is now available and certainly makes for some fun experiments, especially if you're already familiar with techniques from languages like C++.
</i>
</quote>
<p>
He <a href="http://www.mikenaberezny.com/archives/39">gives</a> some sample code, and mentions the "magic methods" the extension allows. Later in the post, he also looks at a related package (also by <i>Sara</i>) that allows for self-modifying code in PHP - <a href="http://pecl.php.net/package/runkit">pecl/runkit</a>. ]]></description>
      <pubDate>Thu, 02 Feb 2006 06:42:59 -0600</pubDate>
    </item>
  </channel>
</rss>
