Thursday, October 21, 2010

Speaking at ZendCon 2010

This year I was invited to speak at ZendCon 2010, the PHP conference of the year in Santa Clara, CA (USA). I'm giving three talks there and I host the uncon sessions (see my previous announcement about that).

I'm not only sharing the stage with great icons from the community, but I'm also celebrating the fact I recently became a ZCE for PHP 5.3.
At the end of ZendCon, I'll be a part of a community panel to answer questions regarding community and user groups. At PHPNW I closed the conference with a short but powerful community talk that inspired people to start a local user group in the area they live. I hope to inspire more people at ZendCon.

Overview of talks
Improving QA on PHP projects
Everyone talks about raising the bar on quality of code, but it's always hard to start implementing it when you have no clue where to start. With this talk I'm showing that there are many levels developers can improve themselves by using the right tools. Many tools are PHP based, so you can implement more features if you need them because it's all PHP.

Unit testing after Zend Framework 1.8
With the release of Zend Framework 1.8 lots of things changed internally, and so changed the way to test your applications. My presentation will go in depth in the new unit testing features and will give examples to test your application on several levels like database tables, web services, library components and controllers.
Some parts require specific attention in order to ensure a good quality of Tests (like Zend_Application, Zend_Db, Zend_Ldap, Zend_Service, Zend_Controller) while other parts can be included as parts of earlier mentioned tests.


Why Zend Framework powers the enterprise
With this talk I explain a bit of history of how I've got involved with Zend Framework and how it became the most popular framework within enterprises and other businesses. I showcase also a couple of projects that you don't immediately link to Zend Framework, just to show that it is possible to go beyond the sky and have space as your final fronteer.

If you're going, great ! I'll see you there. I'll be the guy on stage… 4 times.

If you're not going, think again. ZendCon is not only a place to learn all there is to learn about PHP, it's also the place to approach people behind all those cool open-source tools you're using each day. They won't bite you if you ask them questions. Meet the community around PHP and experience first hand what it feels like to have the best support network ever. You even have stage-time to present PHP stuff yourself !!! How cool is that.

Ok, so it is expensive. But see what you get in return: new friends, new knowledge, great atmosphere and above all… a grasp of what the PHP community is all about. It's not too late to get your ticket and join the fun !

See you there…

Tuesday, October 19, 2010

Preparing for php 5.3 certification exam


Today was a joyful day as I passed the Zend PHP 5.3 certification exam at Global Knowledge, a Pearson Vue exam center here in Mechelen. Since I announced this happy moment on Twitter, I got lots of congratulations from the community but also a lot of questions from PHP developers who were thinking about taking the exam.

Before starting the exam, I had to sign a non-disclosure contract with Zend Technologies, Inc. to keep the contents to myself, so don't ask me what questions were asked.

I can write a short article on how I prepared myself to pass the exam and what you can do to achieve the same successful outcome.

First of all, I was happy when Zend announced in it's ZCE newsletter (which I cannot link here yet) the brand new PHP 5.3 exam was available for purchase and I purchased a voucher immediately. Once I had the voucher, I could pick an exam center nearby and select an available date for the exam. Today was that date.

I had about a week to get prepared and a lot of job-related tasks piled up, so I needed to go the extra mile on time to refresh my knowledge of previous Zend Certification exams and see what was new with this PHP 5.3 exam.

My first point of focus was the Zend PHP 5.3. Certification Guide that I could download once I signed up for the exam.  As I expected, it gave me merely an overview of topics that the exam covered, but since the guide itself was still in beta and I found a lot of mistakes in it, I turned to my old-time favorite reference: the php.net website.

The parts I looked at in preparation of the exam were:
After running a couple of examples with some own modifications and reviewing the SPL slides of Elizabeth Marie Smith (@auroraeosrose), Mathew Turland (@elazar) and my own, I was more confident about taking this PHP 5.3 exam.

As it turned out, my approach worked well as I passed the exam. Besides looking up the different aspects of PHP, my long career as PHP developer also helped passing the exam.

The reason I wanted to get certified is simple: it gives me a higher value in the market. Most customers I deal with (mostly enterprises and governments) directly or indirectly through subcontracts require some form of reference of my skills. Being a ZCE gives me this reference. Having good letters of recommendation or positive feedback on Linkedin.com are not enough.

Speaking of Linkedin, there was a thread questioning the value of a Zend Certification and after reading most pros and cons, it all comes down what type of customer you're dealing with.

A final advice: talk to your local PHP user group. They might have a discount code for you for signing up taking the PHP 5.3 exam. It can save you a fair bit of money, which is always nice.

So, if you decide to take the step, good luck. If you go to ZendCon this year, you can sign up for taking the exam for free and even get a crash-course right there at the conference. Did you know you get a discount on the ZendCon ticket if you're a ZCE ? Always nice, isn't it.

Monday, October 04, 2010

Speaking at PHP North West 2010

Work has been crazy this year, with a lot of stuff going on professional and personal and in between this energetic chaos I totally forgot to mention I'm speaking at one of the best community driven conferences: PHP North West 2010 (sorry Jeremy).

But it's never to late to announce that I will be speaking about "Unit Testing with Zend Framework after version 1.8" and a community talk "Community works!".

Unit testing after Zend Framework 1.8
Now that I'm dealing with a ZF-1.7 project, I cannot emphasize how much I'm missing Zend_Application. So besides simple model testing we take it a step further into testing controllers, forms, helpers and doing some integration tests of databases and services. Clean examples show you exactly you can set up your system so it runs like a charm.

If you say you deliver quality, come and see my session so you can prove you deliver quality.

Community Works
Hey, we all have seen, heard and loved Lorna Jane's legendary talk "Open source your career" where she reflects on herself as how the community has influenced her (professional) life. I'm just going to show you what the secret is behind the community and how you can be a part of it.

Conclusion
If you're in the Manchester area this weekend, be sure to come to PHP North West 2010 conference. Besides me, you'll find a lot of rock stars talking about PHP or related stuff.

Friday, October 01, 2010

Single User Zend_Service_Twitter

When running a website for yourself or your company based on Zend Framework, you might want to show the Twitter messages to your audience.

Although the Zend Framework manual extensively describes how to set up a true Twitter application with the new OAuth implementation of Twitter using Zend_Service_Twitter and Zend_Oauth (since ZF-1.10.0), this is not what you're looking for. You need a simple approach, using the single user OAuth implementation of Twitter.

Registration at Twitter.
Register your "app" to twitter at http://dev.twitter.com/apps/new where you'll be presented a registration form for your app. Since it's not really an app, you should register your website as the app.
Once registered, you need to accept the general terms for usage of the Twitter API.


Once accepted, your applications registered and you can start implementing it. But for a single user approach, you need to retrieve your access tokens.
Fetching tweets
Now it's time to fetch those tweets and post them on your website.

Since these tokens are config elements, we store them in our application.ini as we keep this as our main configuration file for our whole website.

[edited 10/3] These configuration settings are bogus and won't work on my personal account!

; Twitter service
service.twitter.oauth.username = "DragonBe"
service.twitter.oauth.oauth_token = "1234567-xPhPanDz3nDfRam3W0RkN0wW1THS1nGl3Z3nd0aUth"
service.twitter.oauth.oauth_token_secret = "8tH1sStr1nGmUstB3sT0r3ds0MwH3r3V3RryS3cr3t"

Now a simple model can be used to set up the verification process and retrieve the Twitter instance.

<?php
class Application_Model_TwitterClient
{
protected $_config;
protected $_twitter;

public function __construct()
{
$config = new Zend_Config_Ini(
APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
$this->_config = $config->service->twitter->oauth;
$this->_twitter = new Zend_Service_Twitter();
}

public function authenticate()
{
$accessToken = new Zend_Oauth_Token_Access();
$accessToken->setToken($this->_config->oauth_token)
->setTokenSecret($this->_config->oauth_token_secret);

$this->_twitter->setLocalHttpClient(
$accessToken->getHttpClient($this->_config->options->toArray()));
return $this->_twitter->account->verifyCredentials(); } public function getTwitter() { return $this->_twitter; } }

Now we just need to call this model in our controller to retrieve the messages themselves

<?php
class IndexController extends Zend_Controller_Action
{
public function indexAction()
{
$twitterClient = new Application_Model_TwitterClient();
$result = $twitterClient->authenticate();
$twitter = $twitterClient->getTwitter();
$status = $twitter->status->userTimeline();
$this->view->statusMsgs = $status;
}
}

And in your view you just loop through those status messages

<li class="myTweetList">
<?php foreach ($this->statusMsgs as $tweet): ?>
<li><?php echo $this->escape($tweet->text); ?></li>
<?php endforeach; ?>
</ul>

Of course you need to add your own validation and caching to this code. But in a nutshell this works pretty damn good.

I've even build a model around retrieving those twitter messages and the actual properties of a Twitter status, but this is beyond the scope of this article.

If you find this information useful, or if you have a better approach, let me know in the comments.
Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License.