Try Yii Framework for your next large-scale web 2.0 application…

…it may be worth it! The Yii Framework is built for speed and the goal is to provide the best possible framework for your next large-scale web 2.0 applications. With it’s superior performance, Yii still provides an easy-to-use and highly extensible feature set that is richer than most other frameworks.

If you haven’t tried Yii you should have a look at the “Create your first Yii application” tutorial to see how easy it it to get started and learn how a typical Yii application is structured.

Performance has been top of mind during the whole development life cycle and the Yii development team continues to push the boundaries compared to other similar frameworks. Check out the updated performance benchmarks which includes numbers from the upcomming 1.0.1 release.

Yii Framework 1.0 released!

Qiang Xue (creator of the PRADO Framework) has just released the stable version of his new Yii Framework released under new BSD license.

Yii is a high-performance component-based PHP framework for developing large-scale Web applications.

Yii comes with a full stack of features needed by today’s Web 2.0 application development. It is written in strict OOP and is easy to learn with its detailed tutorials. And its highly reusable components allows one to rapidly build up a Web application that is efficient as well as robust.

The name Yii (pronounced as [i:]) stands for easy, efficient and extensible

The Yii Framework builds upon learnings and findings from over 5 years of development of PRADO. If you already know PRADO you’ll get the hold of Yii quite fast.

The framework is already documented quite well in The Definitive Guide to Yii (a good place to start for beginners), in addition to complete class reference and an active forum where you can meet other developers.

Yii Framework also have a Extension Repository where developers can share their own components.

Last but not least, check out how Yii Framework beats the most used PHP frameworks out there in this performance benchmark.

If you have tried it or plan to try it I’ll be happy to hear about your experience with this framework.

The return value of include

PHP never stops surprising me. I just found out that you’re able to return values from the inclusion statements (require, require_once, include and include_once) through an example of Zend_Config.

That means you’re able to write a config.php-file like this:

return array(
  'hostname' => 'localhost',
  'database' => 'test',
  'username' => 'test',
  'password' => 'test',
);

And use it like this:

$config = include 'config.php'; // $config is now the array
var_dump($config);

A side not here is also that PHP support dangling commas. I always leave the last comma in the array so I don’t forget to add it when I add a new line of configuration.

Washing emails

Introduction

In this tutorial I’ll show you how to create a simple PHP script to cleanup a list of email addresses. As a web developer you have probably been asked to wash a list of emails from a manager or marketer some times. Here’s the ultimate solution.

Requirements

There’s a few basic requirements when it comes to washing a list of emails:

  1. Remove duplicates
    You don’t want to have multiple occurrences of the same email address
  2. Verify that the email address exists
    You want to be sure that you validate the domain in the email so you get rid of all spelling mistakes like “htmail.com”, “hotmail.cm”, “gmai.com” etc.

    Douglas Lovell at IBM Research has written a nice article about email validation in PHP. Email validation is a complex topic when it should be done right so we are going to build upon his findings and use his email validation function.

  3. Use pipes
    The script should utilize STDIN and STDOUT so that the script can run without any modification or configuration on various UNIX machines.

    That means you would like to use it like:

    $ cat dirty_emails.txt | php wash.php > clean_emails.txt
  4. Flexibility
    The script should work on as most PHP installations as possible because of privacy issues.

The script (wash.php)

Let’s look at the code inside wash.php.

Download wash.php

Conclusion

As you see this is a very simple script but I can’t count how many hours of work it has saved me. Always look for simple solutions and think about code reuse.

Stay tuned for more tutorials

This is just a small update with a notice that I’m planning to post a lot more tutorials on my blog. I’ve used a lot of time learning ActionScript 3 and related Flash technologies over the last 2 years. I’ve always loved playing with computer graphics and Flash/AS3 is a really nice technology to play with (especially with all the particle systems, physics engines and 3d engines that are available now). While learning AS3 I’ve done a lot of prototyping and testing out different libraries. Since much of it is never going to be released in any products I’m planning to show some of it here.

What kind of topics are you interested in when it comes to both PHP and/or Flash? (with some feedback from you I may be even better fit to target my topics) Challenge me…

PRADO support in NetBeans?

Petr Pisl, project lead of the NetBeans PHP Team has started to play around with the PRADO Framework and showed real interest in creating a plugin for PRADO in NetBeans. This is really good news for the PRADO community that are in need of an IDE.

If you are interested to know more I’ve written down a few initial requirements here and you can follow the ongoing discussion in this thread on the NetBeans forum.

Inside Web Development

I’ve just started a new online magazine with a few friends.

Inside Web Development” is an online magazine for web professionals. The magazine is an collaborative effort to share information, research and knowledge between professional web developers on a daily basis.

Simple navigation with Away3D

I just built a simple navigation system in Away3D with TweenMax to check out how to move the camera around with tweens and interact with 3D objects in Away3D. The scene is quite simple with a few basic primitives. You can zoom in and out on predefined locations (the cubes) and you zoom out again by clicking anywhere on the screen.

Here’s the result:

Source code: NavigationTest.as

I found out is that you can group all objects that are going to have the same behavior on event handling into an ObjectContainer3D which helped reduce some typing. I also needed to create a Plane as a background to be able to add an event listener for mouse down on background.

This test helped me understand quite much of how Away3D works, hope it helps you as well.

Announcing PlanetFlash.org

PlanetFlash.org is here!

Planet Flash is a central place to look for news from the Flash community. It downloads news feeds published by blogs from Flash designers and Flash developers all around the world and aggregates their content together into a single combined feed, latest news first.

Let me know if you don’t find your Flash blog there :)

Loading Object Files (.obj) in Papervision3D

While working on a recent campaign we had a bit tricky production pipeline. Our 3D artist was working with modo but needed to export to Collada (which is not supported by modo and currently one of the best supported formats in Papervision3D). To be able to export his work to be used with Papervision we needed to export all the models as object files (.obj) and import them into Blender (which supports Collada export).

To overcome this two-step process (and since I knew the OBJ-format from my Computer Graphics course at college) I started to dive into writing my own an OBJ-parser for Papervision3D.

It went pretty well actually. I got some help on the Papervision mailinglist and ended up with this result (see OBJ-parser source).

It’s really simple to use actually. You can just use it as the other parsers that comes with Papervision by default. Download OBJ.as, put it together with the rest of the parsers in the GreatWhite branch. Here’s a simple example from my prototype:

var fish:OBJ = new OBJ("fish.obj", "fish.mtl");
scene.addChild(fish, "Fish");

This code loads all the geometry data from the fish.obj-file and material data from the fish.mtl-file and store it in the Papervision object model. Then the object is added to the scene so it will be visible when the scene is rendered.

The OBJ-parser currently supports:

  • Geometric vertices, Texture vertices and vertex normals
  • Seperate objects for each group
  • Parsing materials from Material Library File (.mtl)

Get the source (OBJ.as)