In my Beyond Frameworks talk, I explained how a component-based architecture can help answer some of the important (i.e. expensive!) questions you might face when creating long-lived apps that rely on a PHP framework. In this series of blog posts, I’m going to look at how to go about creating and working with components.

Getting Started

  1. Watch my talk from the PHP UK conference, where I explain the long-term costs of relying just on frameworks, and why a mixture of frameworks and components is the more pragmatic way to go.
  2. Read the slides that accompany the talk. Share them with your colleagues. Discuss them in your local PHP user group.

The Tools We Use

To make it much easier to work with components (and especially to work with lots of components), I’ve put together some useful tools. You’ll need to download them and install them into your dev environment:

  1. Phix Project website
  2. Introducing phix (updated September, 2011)
  3. Installing phix onto Apple Mac OS X
  4. Installing phix on Ubuntu
  5. Installing phix on Fedora
  6. Installing phix on Debian
  7. Installing phix on CentOS / RHEL

Here’s what has changed from release to release:

I’ll add links to any further blog posts about the tools as and when they come up!

Working With PHP Components

You’ve watched the video, and read why a component-based architecture is the way to go. You’ve installed the tools. But now what? In these blog articles, I show you step by step how to build the components for an app, and discuss many of the subtleties that you’ll come across with this approach.

  1. Planning An App That Uses Components
  2. Decomposing An App Into Components
  3. Creating A Skeleton Component
  4. Setting Up Your Component’s Metadata, Pt 1
  5. Setting Up Your Component’s package.xml File
  6. Adding Unit Tests For Your Component
  7. Where To Put Your Component’s Unit Tests
  8. How To Run Your Component’s Unit Tests
  9. Dealing With PEAR Dependency Quirks
  10. Working With Non-Namespaced Components
  11. Testing Remote Web Services The Quick And Nasty Way
  12. Unit Test Coverage For Components
  13. Making A PEAR-Compatible Package
  14. Setting Up Your Own PEAR Channel
  15. 3 Tips For Publishing Your Own PEAR Channel
  16. Publishing Your PEAR Channel On GitHub

Anatomy Of A Component

Want to know what is inside each component, or where something is meant to go? Here’s the skinny:

  1. Explaining File Roles In PHP Components
  2. Shipping Reusable PHP Code
  3. Shipping A Command-Line Program
  4. Shipping Data Files With Your Components
  5. Shipping Documentation With Your Component
  6. Shipping Unit Tests With Your Component
  7. Shipping Web Pages With Your Component

More to come :)

3 Comments

  1. Stuart Herbert on Beyond Frameworks | PHPtrends.net says:
    March 31st, 2011 at 11:25 am

    [...] and all around nice guy, has been posting a series of posts on his blog based on his PHPUK talk “Beyond Frameworks”. There are a grand total of 13 posts, all made within a 7 day period, an astonishing feat to say [...]

  2. Emran Hasan says:
    May 7th, 2011 at 11:54 am

    Hi Stuart,

    That’s an excellent series you’re writing and it’s moving along nicely. Can you share with us when you’re planning to write the next parts? I believe you have some more code to show as how to slowly complete the project.

    Looking forward to your response and thanks for the series!

    Emran

  3. Khayrattee Wasseem says:
    February 27th, 2012 at 11:03 am

    This is a GREAT set of article and your ideologies make very much sense. I like the idea of decoupled components, layering them. AWESOME work!
    A must read for any PHP programmer.

    //Wasseem