<?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>Wed, 22 May 2013 14:21:31 -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[Peter Meth: The Road to True North PHP ... Reflections]]></title>
      <guid>http://www.phpdeveloper.org/news/18566</guid>
      <link>http://www.phpdeveloper.org/news/18566</link>
      <description><![CDATA[<p>
<i>Peter Meth</i> one of the organizers of the <a href="http://truenorthphp.com">True North PHP Conference</a> (happening at the beginning of November) has <a href="http://methlog.com/blog/2012/10/05/the-road-to-true-north-php-reflections/">a new post</a> sharing some of his experience as a (PHP) conference planner so far.
</p>
<blockquote>
As you may or may not know I have been planning a conference called <a href="http://truenorthphp.ca/">True North PHP</a> with my friend <a href="https://twitter.com/grmpyprogrammer">Chris Hartjes</a>. I wanted to blog about some of my experiences in planning the conference and reflect back on what brought me here. This blog is especially important to me since this is the first time I am organizing a conference and would appreciate all the feedback I can get. I hope to do several posts over the next month leading up to the conference.
</blockquote>
<p>
He talks some about his own background in the programming industry and how, thanks to his renewed interest in PHP, he was able to connect with the community and start the idea of a Toronto-based conference. He mentions <a href="http://confoo.ca">Confoo</a> as a conference he enjoyed and one that pushed him forward to want something like that locally. 
</p>
<p>
If you're in the Toronto area (or want to visit in early November) and you haven't checked out the <a href="http://truenorthphp.com">True North PHP Conference</a> yet - you definitely should. It's a great two days packed with PHP goodness and <a href="http://truenorthphp.ca/tickets.php">tickets are already on sale</a>! (and here's the <a href="http://truenorthphp.ca/schedule.php">schedule</a>).
</p>]]></description>
      <pubDate>Mon, 08 Oct 2012 08:15:27 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Zumba Engineering Blog: Creating bash completion to your console application]]></title>
      <guid>http://www.phpdeveloper.org/news/18383</guid>
      <link>http://www.phpdeveloper.org/news/18383</link>
      <description><![CDATA[<p>
On the Zumba Engineering blog there's a new post showing you how to <a href="http://engineering.zumba.com/2012/08/20/creating-bash-completion/">implement bash shell "autocomplete"</a> with a special option for a second argument.
</p>
<blockquote>
This weekend I saw the <a href="https://github.com/AD7six/cakephp-completion">bash completion for CakePHP</a> from <a href="http://ad7six.com/">Andy Dawson</a> and had an idea to do the same for our service application, because we frequently forget the exactly job class or method name and add extra steps to verify these names before execute the job. I read his code, made some research and finally get our bash completion working fine.
</blockquote>
<p>
In his case he wanted to see what things a module in the application had to offer, so he implemented a "__check__" argument that looked at the third argument and used reflection to get the methods allowed for it. Also included in the post is the bash alias you'll need to set up to get it working (and where to put it to make it cooperate).
</p>]]></description>
      <pubDate>Tue, 21 Aug 2012 09:47:52 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Mike Purcell's Blog: PHP - Reflection Class - Determine Parent Method Signature]]></title>
      <guid>http://www.phpdeveloper.org/news/18185</guid>
      <link>http://www.phpdeveloper.org/news/18185</link>
      <description><![CDATA[<p>
In <a href="http://melikedev.com/2012/07/03/php-reflection-class-determine-parent-method-signature/">this recent post</a> to his blog <i>Mike Purcell</i> shares a method he found to discover the parameters required by a method in a class' parent via <a href="http://php.net/reflection">reflection</a>.
</p>
<blockquote>
According to <a href="http://us.php.net/manual/en/memcached.get.php">PHP docs</a> regarding the Memcached::get() method, there are three arguments which which must be added to my extended signature, which I added, but kept getting "...should be compatible with that of Memcached::get()" errors. I tried looking for the method signature via source code but didn't glean anything useful from the <a href="https://github.com/php-memcached-dev/php-memcached">PECL documentation</a>, so I turned to <a href="http://us3.php.net/reflectionclass">PHP's RelectionClass</a>.
</blockquote>
<p>
He includes a quick snippet of code showing how the check works and the handy output it produces - a set containing the parameter name, if it's require or optional and it's definition.
</p>]]></description>
      <pubDate>Thu, 05 Jul 2012 10:12:04 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Introspection and Reflection in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/18006</guid>
      <link>http://www.phpdeveloper.org/news/18006</link>
      <description><![CDATA[<p>
On PHPMaster.com today there's an <a href="http://phpmaster.com/introspection-and-reflection-in-php/">introduction to Reflection</a>, a feature of PHP that allows you to peer into the code itself and find out metadata like class properties, scope levels and parent classes.
</p>
<blockquote>
PHP introspection is a common feature in any programming language which allows object classes to be manipulated by the programmer. You'll find introspection particularly useful when you don't know which class or method you need to execute at design time. [...] During this article, you'll see a couple examples of how to use some of the most useful PHP's introspection function and a section dedicated to an API that offers functionality similar to introspection, the Reflection API.
</blockquote>
<p>
They introduce you to a few different methods including <a href="http://php.net/class_exists">class_exists</a>, <a href="http://php.net/get_class">get_class</a> and <a href="http://php.net/is_subclass_of</a> and examples of their use. There's also a few other useful functions described like <a href="http://php.net/get_class_vars">get_class_vars</a> and <a href="http://php.net/method_exists">method_exists</a>. They also briefly mention the "ReflectionClass" that's a part of the PHP Reflection API and how it can be used to make an instance pointing to a current class.
</p>]]></description>
      <pubDate>Fri, 25 May 2012 14:03:57 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Chris Hartjes' Blog: Metatesting: Extending Your Testing Tools]]></title>
      <guid>http://www.phpdeveloper.org/news/17851</guid>
      <link>http://www.phpdeveloper.org/news/17851</link>
      <description><![CDATA[<p>
<i>Chris Hartjes</i> has had a few posts about "metatesting" already and in <a href="http://www.littlehart.net/atthekeyboard/2012/04/19/metatesting-extending-your-testing-tools/">this latest article</a> he takes the series one more step. He looks at moving outside of the current toolset and expanding on them to meet your testing needs.
</p>
<blockquote>
While <a href="http://phpunit.de/">PHPUnit</a> is awesome out of the box, it still lacks some tools that are required to do things like test protected class methods or assign values to protected class attributes. Lucky for me we have an awesome testing engineer at Kaplan named <a href="https://twitter.com/FreshWillisms">Will Parker</a> who has shown me some ways that they have extended PHPUnit itself to make testing certain things easier.
</blockquote>
<p>
<i>Chris</i> talks about things like testing protected methods (easy thanks to a helper) and checking the value of a class property. The key to both of them lies in using PHP's own <a href="http://php.net/reflection">Reflection</a> functionality to alter properties on the class objects themselves.
</p>]]></description>
      <pubDate>Mon, 23 Apr 2012 11:27:02 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Slawek Lukasiewicz's Blog: Zend Framework: Reflection]]></title>
      <guid>http://www.phpdeveloper.org/news/16403</guid>
      <link>http://www.phpdeveloper.org/news/16403</link>
      <description><![CDATA[<p>
<i>Slawek Lukasiewicz</i> has a recent post to his blog looking at a tool that comes bundled with PHP that can help you find out more about your own code (or really any other piece of code out there) - <a href="http://www.leftjoin.net/2011/05/zend-framework-reflection/">the Reflection API</a>. In his post he looks specifically at the functionality the <a href="http://framework.zend.com">Zend Framework</a> has built on top of the base <a href="http://php.net/reflection">PHP API</a>.
</p>
<blockquote>
Zend Framework has own Reflection extension. It is mostly build upon genuine <a href="http://php.net/manual/en/book.reflection.php">PHP Reflection API</a> and extends existing features. The completely new Zend_Reflection module feature is introspection of docBlock tags.
</blockquote>
<p>
He includes two code examples using this component of the framework - grabbing the docblock off of a specific method (and even how to grab specific tags from inside it) and how to grab the body content out of a given method, with or without the docblock attached.
</p>]]></description>
      <pubDate>Tue, 31 May 2011 08:18:56 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Gonzalo Ayuso's Blog: Reflection over PHPDoc with PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/16143</guid>
      <link>http://www.phpdeveloper.org/news/16143</link>
      <description><![CDATA[<p>
<i>Gonzalo Ayuso</i> has a new post to his blog today talking about a regular expression-laden script he's some up with to <a href="http://gonzalo123.wordpress.com/2011/04/04/reflection-over-phpdoc-with-php/">reflect over a PHP file</a> and pull out the document's comments (PHPDoc-style).
</p>
<blockquote>
I want to parse PHPDoc code. Let me explain a little bit what I want to do. Imagine a dummy function documented with PHPDoc. [...] PHP has a great reflection API, but as at least in the current PHP version (as far as I know) we only can get the PHPDoc as a string, without parse it. I need to get the parameters and the type of them with reflection. [...] But the type is different. 
</blockquote>
<p>
His script (based loosely on a bit of a component from the <a href="http://framework.zend.com">Zend Framework</a>) parses the file and its comments and grabs the variable types from the PHPDoc blocks on each method and associates them.
</p>
<p>
If you're looking for a more mature solution than just this script, take a look at <a href="https://github.com/mvriel/Docblox">Docblox</a>, a PHP 5.3 documentation generator.
</p>]]></description>
      <pubDate>Mon, 04 Apr 2011 12:51:15 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Eric Lamb's Blog: Practical PHP Reflection]]></title>
      <guid>http://www.phpdeveloper.org/news/16000</guid>
      <link>http://www.phpdeveloper.org/news/16000</link>
      <description><![CDATA[<p>
<i>Eric Lamb</i> came up against an interesting situation recently and found that PHP's Reflection API was the best thing to <a href="http://blog.ericlamb.net/2011/03/practical-php-reflection/">come to his rescue</a>.
</p>
<blockquote>
The perfect problem where the Reflection API appears to be the perfect solution. For me this came up a couple months ago while I was working on a European zip code radius project that had to be built using one of those obfuscated and ill documented 3rd party commercial programs (nothing worse than when the platform is forced on you). So, I had to use this program that was intentionally encoded to prevent me from doing what I wanted to do. I couldn't even look at the code; it was completely obfuscated.
</blockquote>
<p>
To illustrate his point, he gives examples of two built-in classes that PHP has and the result of their reflected output - SimpleXMLElement and DateTime. He shows how to get the structure of the class in general and how to use some of the more specific functions to get things like properties, methods and constants for the class. This is perfect for those undocumented features and isn't too far of a jump away from building out your own documentation.
</p>]]></description>
      <pubDate>Fri, 04 Mar 2011 12:23:28 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Box UK Labs: Dependency Injection and Reflection library]]></title>
      <guid>http://www.phpdeveloper.org/news/15607</guid>
      <link>http://www.phpdeveloper.org/news/15607</link>
      <description><![CDATA[<p>
On the Box UK Labs site there's <a href="http://www.boxuk.com/labs/dependency-injection-and-reflection-library">an interesting dependency injection tool</a> that uses Reflection to get some of the work done. 
</p>
<blockquote>
Dependency injection is a well known concept, and there are currently a plethora of DI containers available from one of the interweb's many pipes. These include Symfony and Crafty, while the Zend Framework also has its own DI container. So why another? One of my personal goals as a developer is to make things so simple, even I can understand them. But most of the DI containers I've come across require too much configuration, and usually via XML - yuck! So how is ours different?
</blockquote>
<p>
The tool, <a href="http://github.com/boxuk/boxuk-di">boxuk-di</a>, makes use of the <a href="http://code.google.com/p/addendum/">Addendum</a> tool to create injectable objects easily accessed via a namespace. You can also use type hinting, scoping and annotations to do special things (like make singleton injection objects). The also mention how primitives are used as well as dispelling some of the misconceptions around reflection and this particular tool.
</p>]]></description>
      <pubDate>Tue, 21 Dec 2010 08:45:24 -0600</pubDate>
    </item>
  </channel>
</rss>
