namespace

Create your own framework... on top of the Symfony2 Components (...

Planet PHP  Sun, 01/15/2012 - 03:53

One down-side of our framework right now is that we need to copy and paste the code in front.php each time we create a new website. 40 lines of code is not that much, but it would be nice if we could wrap this code into a proper class.

It would bring us better reusability and easier testing to name just a few benefits.

If you have a closer look at the code, front.php has one input, the Request, and one output, the Response.

Our framework class will follow this simple principle: the logic is about creating the Response associated with a Request.


 

3 Ways to Access a Namespaced PHP Class - Lorna Mitchell

Planet PHP  Mon, 11/29/2010 - 06:33

After what felt like years of debate over the notation to use for PHP's namespaces, it seems like the feature itself has had relatively little use or attention since it was actually implemented in PHP 5.3.

We're all used to working without it but using it does make code neater.

Take this example (in a file called namespaced-class.php)

namespace Christmas\DaysOf; 

class PartridgeInAPearTree{


 

Gonzalo Ayuso's Blog: Using Monkey Patching to store files in Co...

PHPDeveloper.org  Thu, 09/02/2010 - 13:10

Gonzalo Ayuso takes his "CouchDb as a filesystem" approach one step further (see the previous post about it here) with this new post talking about monkey patching to store files into the CouchDb server using the normal PHP file handling functions.


 

SitePoint PHP Blog: How to Use PHP Namespaces (Parts 2 &3)

PHPDeveloper.org  Wed, 07/15/2009 - 07:16

The SitePoint PHP blog has posted the next two parts of their series looking at using namespaces in PHP - parts 2 and 3:

In the second part of the series they build on the basics and look at importing namespaces into a script, aliasing them to a shorter, easier to use name and some rules to consider about name resolution.


 

Ibuildings techPortal: Migrating to PHP 5.3

PHPDeveloper.org  Tue, 06/30/2009 - 11:13

PHP 5.3 may have officially just launched but the Ibuildings crew has been preparing for it and have already posted this guide to help you make the migration up to this latest version.