• Easier XML-RPC for PHP 5 February 19th, 2007

    Posted by Mike Naberezny in PHP   -   6 Comments

    A few weeks ago, I rewrote the Zend XML-RPC client as part of a customer project at Maintainable. After fixing a fair number of bugs and writing a test suite, I made some enhancements and usability improvements. You can learn more about the new XML-RPC client from its documentation. Here it is in a nutshell:

    Calling Remote Methods

    The new XML-RPC client has always functioned similarly to many existing PHP implementations, providing a call() method:

    $c = new Zend_XmlRpc_Client('http://framework.zend.com/xmlrpc');
    echo $c->call('test.sayHello');

    The call() instance method accepts an optional parameter with an array of parameters to marshal to the remote method. These may be native PHP types or PHP objects representing XML-RPC types. The latter is useful for the XML-RPC datatypes that do not map directly to PHP equivalents, such as base64.

    Server Proxy Objects

    The above usage works fine for many purposes but could read easier and gets tedious after many method calls. One of the few advantages of serializing method calls with a protocol like XML-RPC or SOAP is that with a little extra work in the client libraries, the remote service can be exposed in a way that’s very close to a native PHP object. This is where the server proxy comes in.

    In the above example of test.sayHello(), the remote sayHello() method is in the XML-RPC pseudo-namespace test. We can use the new XML-RPC client’s getProxy() method to get a proxy to this remote namespace and then use it similarly to a normal PHP object.

    $c = new Zend_XmlRpc_Client('http://framework.zend.com/xmlrpc');
     
    $test = $c->getProxy('test');
    echo $test->sayHello();

    Namespaces may be nested to any depth so the XML-RPC method foo.bar.baz() becomes $foo->bar->baz().

    Faults

    Faults resulting from the remote method call are automatically thrown as PHP exceptions. XML-RPC fault responses are thrown as Zend_XmlRpc_FaultException and transport errors are thrown as Zend_XmlRpc_HttpException. If this is not desirable for some reason, a doRequest() method provides a way to work with request and response objects directly.

  • Best Practices of PHP Development October 30th, 2006

    Posted by Mike Naberezny in PHP, Testing   -   4 Comments

    Slides from my ZendCon 2006 session are now available:

    It is a new, three hour talk that I developed and presented together with Matthew Weier O’Phinney. This is the second opportunity that Matthew and I have had to team up for a session at ZendCon and it was a great time again.

  • Introducing Zend Framework October 24th, 2006

    Posted by Mike Naberezny in PHP   -   Post a comment

    The April 2006 issue of php|architect magazine featured my article, “Introducing Zend Framework“. It can now be downloaded in PDF format. Thanks to php|architect for making it available for free.

  • DC PHP Conference Slides October 20th, 2006

    Posted by Mike Naberezny in PHP   -   1 Comment

    Slides from my DC PHP Conference talks are now available:

    Special thanks to my friends Chuck Hagenbuch, Matthew Weier-O’Phinney, and Paul M. Jones for their feedback and help preparing the talks.

  • Upcoming Talks September 11th, 2006

    Posted by Mike Naberezny in PHP, Ruby   -   Post a comment

    The nice folks behind the DC PHP Conference asked me to put out a note to let you know I’ll be speaking there, so here’s a bit about the talks I’ll be giving and other events I’ll be attending in the next couple of months:

    DC PHP Conference (Oct 18-20)

    • PHP Intranet Web Services is a new talk that is geared to fit into the conference’s theme of “integration with the federal government”. PHP is an excellent glue language for integrating web services and legacy applications on intranets and there are a host of libraries available to help. We’ll explore some of these options and talk about the unique aspects of developing PHP-based services behind corporate firewalls.
    • Getting Started with Zend Framework will give developers a jumpstart on developing with the Zend Framework. A brief introduction will include installation, an architectural overview, comparing it with alternatives, and explaining its process and online resources. We’ll then dive right into some of the more useful components through examples with sample code. I’ve been around the Zend Framework longer than most so feel free to bring all of your questions for Q&A and code for possible hacking sprints later.

    Zend/PHP Conference 2006 (Oct 30 - Nov 2)

    • Best Practices of PHP Development will be an extensive three-hour tutorial session. Matthew and I had such a good time speaking at the last Zend conference that we’re doing it together again this year with a new tutorial session. We’ve both been working as professional PHP developers for many years and this is our chance to share some of the PHP development and deployment tricks we’ve learned along the way.

    Other Events

    Since starting my own consulting business, I’ve also been having a great time doing quite a bit of Ruby on Rails development in addition to my usual Python and PHP programming and training. As I dip into Ruby more, I’ll be attending the Pragmatic Studio (Oct 9-11) and also the Rails Edge Conference (Nov 16-18).

    If you’re headed to any of these events, contact me if you’d like to meet up or if you have any requests for the talks.

  • Moving Forward May 17th, 2006

    Posted by Mike Naberezny in PHP   -   4 Comments

    I’d like to share with you a message that I sent to the Zend Framework mailing lists this morning.

    I just wanted to send you a quick note to let you know that next week will be my last as a Zend employee. Since I receive dozens of emails every day from many people regarding the Zend Framework, I thought it would be best to send a general notice to the lists now letting you know that I am in the process of transitioning my work to others.

    You’ve probably noticed that there are some new Zenders on the mailing lists. During the next week, they’ll begin to take over my day-to-day responsibilities such as administering the SVN accounts. Andi will be sending out a note with more information. For those of you that work with me closely, I’ll be sending individual notes letting you know who to contact. Of course, please feel free to email me yourself if you have a specific question.

    After having written the first line of code for the Zend Framework and building its website, it’s very gratifying to see how far we’ve come since the initial release. The response has been overwhelmingly positive and our active community appeared almost overnight. The community has already proved itself invaluable through so many great contributions. I’m confident that the framework will continue to evolve in this positive direction with your continued participation and Zend’s guidance.

    Working for Zend has been a great experience and it is with some sadness that I leave the Zend family. I’ve recently been presented with some development opportunities that are too good to pass up, so I’ll be working for myself again as an independent software contractor. Moving forward, I’ll continue my participation on the framework lists and will most likely do some work for Zend as a contractor in the near future, but I’ll have a less active role in the framework. For those who’d like to keep up with me, you can visit my website at http://mikenaberezny.com.

    I’m very excited about being independent again and beginning new projects. I plan to continue writing articles and blogging actively. I also hope to increase my participation in the greater PHP community.

  • Zend Framework Tutorial Published May 2nd, 2006

    Posted by Mike Naberezny in PHP   -   4 Comments

    The April 2006 issue of php|architect is now available. This issue marks my first appearance in their pages with the cover article, “Introducing Zend Framework”.

    In the article, I begin by introducing Zend’s motivations for creating a framework and how it relates to their PHP Collaboration Project. More information on these topics can be found on the Zend Framework website. I then dive into a tutorial where I take a business scenario and show how the components included in the Zend Framework can be put to work.

    The article demonstrates a workflow where invoice data is retrieved from a web service, an invoice in PDF format is then built from that data, and finally the resultant file is emailed to a customer. The components Zend_XmlRpc_Client, Zend_Pdf, Zend_Mail, and Zend_Search_Lucene are explored along the way.

    I’d like to thank the team at php|architect, particularly Sean Coates, for such a professional and enjoyable experience getting the article to print. I’m looking forward to writing more articles for them in the future.

    Update: The article is now available for free download in PDF format here.

  • Request/Response or Bust April 26th, 2006

    Posted by Mike Naberezny in PHP   -   6 Comments

    My friend Paul M. Jones recently wrote about a component framework called PRADO. The idea of a component framework for PHP is certainly nothing new, with PRADO having won Zend’s coding contest a full year ago. There’s even phpBeans, and PRADO provides some integration with these. PRADO is getting some new attention because it was completely revamped earlier this month. It’s certainly matured considerably since the contest and is the most well-known component framework for PHP. However, in all that time since PRADO was first introduced, the idea of a component framework hasn’t been adopted by the majority of PHP developers. Why is that?

    Although PRADO is a nice piece of software, Paul surmises that a component model as used by Microsoft .NET (Visual Web Developer now free!) and its close cousin PRADO is not the “PHP way” or “PHP spirit”. For the most part, I agree with this. Although, I don’t think it’s necessarily a PHP-specific issue. I think it speaks to a larger architectural decision — how far to abstract out the HTTP request/response paradigm.

    For the majority of websites out there, web application architectures can be lumped into three broad categories, ascending up a ladder by the level of HTTP abstraction:

    • “Page-based” or “file-based” systems are at the bottom. These comprise the majority of CGI and PHP applications. In this style, the application’s files are stored in directories that map directly to URLs. HTTP requests come in, the URL points directly to the file which handles the request, and the response comes out.
    • “Action-based” - While not necessarily part of the MVC pattern itself, this is the style used by the majority of MVC architectures. Ruby-on-Rails, Apache Struts, and Paul’s Solar framework are examples of this type of design. Typically, URLs are initially mapped to controllers and actions within those controllers. These will then chain together into a workflow for processing requests and rendering responses. While at a higher level than page-based systems, the majority of these implementations are still request/response driven, and thus aren’t so much farther away from HTTP.
    • “Component-based”, such as Microsoft .NET and PRADO are the furthest abstraction from HTTP. In these architectures, the request/response paradigm of HTTP is completely abstracted out into an event-driven architecture. Components are objects that simply respond to events, and the interaction between components and mapping to HTTP are all handled by the infrastructure of the framework.

    What’s interesting is that in PHP, page-based is still dominant for most of the web while the action-based (really, MVC) systems for PHP are gaining the most mindshare. These are becoming increasingly prevalent as application complexity continues to increase. The majority of PHP developers seem uninterested in component-based architectures.

    Perhaps it’s because PHP has always been about “getting it done”. Perhaps it is also because the best PHP developers are also used to working close to the metal, always striving for that perfect CSS or fastest page load. As the level of abstraction increases, the ability to tweak and control the application and its rendering tends to proportionally decrease.

    As technologies very close to HTTP like REST become more prominent, abstract components like those in .NET and Java become less relevant. At least, these kinds of components become much less convenient than their initial promise. AJAX on the component model is a double-edged sword. While event-driven architectures are ideally suited for processing asynchronous requests, it takes a lot of sophistication for component frameworks to automatically emit good Javascript for client side. So far, it hasn’t really happened.

    Microsoft’s solution to these challenges is to continue even higher up the ladder of abstraction, while Ruby-on-Rails’ much simpler notions of “components” and Javascript generation is much the opposite. Rails provides a bit more convenience but still stays close enough to the familiar paradigms of HTML generation and HTTP request/response to give good control.

    Good old HTTP seems more PHP-like to me than the Microsoft or Java models. What do you think is the next step for PHP?

    Update: Python blogger Ian Bicking has some great thoughts in his post, HTTP(ish) all the way down.

  • Zend Framework Manual Updated March 13th, 2006

    Posted by Mike Naberezny in PHP   -   7 Comments

    For those of you who are interested in browsing the Zend Framework manual online, I’ve made some improvements to the interface that will make it more enjoyable: http://framework.zend.com/manual/

    There’s no question that the excellent manual at php.net is a big reason that PHP is so easy to use. We recognize this and documentation has been very important to the Zend Framework project from the first day. We aim to always have the highest quality documentation possible, and to make it as accessible as possible by publishing it in multiple formats.

    The distribution currently ships with the documentation in HTML for offline viewing. In the near future, we plan to publish a PDF version as well. There will be many future updates to the website and we plan to also add search capabilities (powered by Zend_Search, of course).

    Documentation is currently available only in English, although already some users have volunteered translations of parts of the manual. After we reach the 1.0 release and the docs stabilize, we’ll begin building our documentation team to do as many localizations as possible. If you’d like to help the Zend Framework succeed in your home country, helping with translations will be a great way to contribute to our effort in the near future.

  • Zend Framework 0.1.2 Released! March 8th, 2006

    Posted by Mike Naberezny in PHP   -   Post a comment

    I’ve just rolled out Preview Release 0.1.2 of the Zend Framework, less than a week since its initial release. We’ve received many great emails and there is now quite a growing community on the mailing list. Thanks to all that are participating by sending in bug reports and feature requests. We’re also excited that several community members have already stepped up and are working on new contributions for the framework. We’ve even begun receiving translations for the documentation.

    In addition to the new community participation, several of our commercial partner companies are working on refining existing code and preparing new components. I hope that the next preview will also include some of this new work, as well as promoting Zend_Search_Lucene from the incubator.

    Preview Release 0.1.2 includes bug fixes, the unit test suite, and additional documentation. Please see the changelog below. The new version can be downloaded from here: http://framework.zend.com/.

    We hope that new releases will become a very frequent event and I encourage you to get involved on the mailing list and send your feedback.

    Zend Framework                                                 NEWS
    
    =RELEASE 0.1.2 / 8-Mar-2006=
    - Unit test suite is now included. (Mike)
    - Docs for Zend_Controller are now included. (Mike)
    - Coding standards were out of date. Reported by Steph Fox. (Mike)
    - Fixed default charset in Zend_Mail constructor. 
      Reported by Jakob Buchgraber. (Mike)
    - Fixed several Zend_Filter methods. (Chris)
    - Fixed JSON datum encoding.  Reported by Edwin Vlieg. (Mike)
    - Fixed FormRadio Helper.  Reported by AJ Tarachanowicz. (Chris)
    - Fixed Zend_Uri_Http to work with new Zend_Filter. (Chris, Mike)
    - Docs for the Zend_Db::factory() method were incorrect.  
      Reported by Dinh. (Chris)
    - Zend::loadClass() now works inside __autoload().  
      Reported by Rob Allen. (Mike)
    - Fixed notices from Zend_Pdf_Element_Dictionary.  
      Reported by Ralf Eggert. (Alex)
    - Fixed notices from Zend_Search_Lucene_Index_SegmentWriter.  
      Reported by Jared Williams. (Alex)
    - Removed defunct Zend_Db_DataObject docs. (Mike)
    - Added NEWS.txt file (Andi)