Series: Beyond Frameworks – PHP Components
Posted by Stuart Herbert on March 26th, 2011
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
- 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.
- 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:
- Phix Project website
- Introducing phix (updated September, 2011)
- Installing phix onto Apple Mac OS X
- Installing phix on Ubuntu
- Installing phix on Fedora
- Installing phix on Debian
- Installing phix on CentOS / RHEL
Here’s what has changed from release to release:
- Phix 0.14 (released 24th October, 2011)
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.
- Planning An App That Uses Components
- Decomposing An App Into Components
- Creating A Skeleton Component
- Setting Up Your Component’s Metadata, Pt 1
- Setting Up Your Component’s package.xml File
- Adding Unit Tests For Your Component
- Where To Put Your Component’s Unit Tests
- How To Run Your Component’s Unit Tests
- Dealing With PEAR Dependency Quirks
- Working With Non-Namespaced Components
- Testing Remote Web Services The Quick And Nasty Way
- Unit Test Coverage For Components
- Making A PEAR-Compatible Package
- Setting Up Your Own PEAR Channel
- 3 Tips For Publishing Your Own PEAR Channel
- 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:
- Explaining File Roles In PHP Components
- Shipping Reusable PHP Code
- Shipping A Command-Line Program
- Shipping Data Files With Your Components
- Shipping Documentation With Your Component
- Shipping Unit Tests With Your Component
- Shipping Web Pages With Your Component
More to come :)
3 Comments
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 [...]
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
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
Add Your Comments To This Article Using The Form Below
Your comments may not appear until they have been approved by a moderator.