30Aug Creating a PHP5 Framework
With websites becoming more and more dynamic and interactive, developers often look to frameworks to help build websites and web apps rapidly. While there are a number of great frameworks available, a custom framework gives you the ability to easily customize the framework as you need, and to build with it even quicker - as you would already know the ins and outs of it before working with it. In this series of tutorials, we are going to build our very own PHP5 Development Framework! Let’s start with planning our framework and put the basic structure into place.
Step 1: This Series
In this series, we will create our own PHP5 Framework from scratch. The Framework will include basic content management features, and we will use it to build a web-based directory for a small organization.
Hopefully, as we go along, you will improve, build up and optimize this framework to suite your needs better, however in these tutorials we are aiming to get a simple framework up and running and powering a website.

Over the next few weeks, during these tutorials we will cover:
- Creating authentication handler, database abstraction layer and template manager
- Bringing these objects together
- Using the framework to manage content, and power our site
- Creating a fantastic front end design.
- Designing for the login process by storyboarding
- How the Framework can be extended and expanded
Step 2: Design Patterns and their use within our Framework
When creating any large computer-based system, be it a desktop application, a distributed network system, or a web application there will always be architectural challenges associated with its implementation.
Design patterns address some of these common problems, and we will make use of a number of design patterns as we create our Framework, to ensure that we have a quality, flexible, robust and usable framework, fit for any purpose! In particular, in this tutorial we are going to look at the Singleton pattern and the Registry pattern.
Step 3: Files and Folders
The first thing to get started creating our Framework, is to create a suitable file structure, such that everything has its place. As well as the files powering the framework, we also need to make provisions for files relating to the website we are going to create with our framework. Most websites and web applications have:
- Some commonly used functions / objects.
- Business logic.
- A design
This gives us a great starting point, files relating to each of those three categories should be grouped together in their own section. Take a look at the directory structure below, we will then discuss the reasons for the structure.

Note that the .settings folder and the .project file were created by the IDE I use, and don’t need to be present in your application
Core functions and objects, such as database access, authentication, template handling, email sending objects, email parsing objects, should be stored within a folder called objects, within the PCARegistry folder. This allows us to separate the logic from the Registry (which we will look at shortly) from the objects stored within the Registry.
Next, we need somewhere to store our business logic which is the files we will create which make use of our framework. We should keep these files in a folder called controllers. Each major function that our website or web application does (e.g. business directory listing, providing and managing content, providing an image gallery, etc) would be a separate controller, stored within its own folder within the controllers folder. We are not going to use these in this tutorial, but it is important to have our directory structure in place, so we know how it will work.
The sites design and templates, should be stored within the skins folder. Since we may want different designs (either so users of the application/website we create with our framework can chose from a number of designs, or to change the design depending on season or special event), each skin will be contained within its own folder.
Read The Rest of this Great Tutorial at Nettus
Related articles by Zemanta
- Is the future of desktop in the cloud ?
- Worth a look: Zend Framework 1.0.0 production release
- Create your own playlist hosting service with Opentape
- Looking Beyond Visual Studio
- Male pattern boldness
- Host Your Own Music Playlist with Opentape [Step By Step]
- Things You Should Know About Web Application Development
- Upcoming Events: Pune Java and Pune Linux monthly meets
- Filespots: Is it Vista? Or the web?
- KITE: Keynote’s Internet Test Environment
- CI gets a pat on the back!
- ANNOUNCEMENT: Bye bye Symfony.. Hello Zend
- Types of PHP Framework: Glue and Full-Stack
- The Ajax Experience Framework Summit
- Speaking at the International PHP Conference
- Web Hosting: the Fascinating World of the World Wide Web!!
- Acquia Announces Beta Launch of Commercial Drupal Distribution
- 10 Video Tutorials for Learning Basic Web Design Skills
- Flash Framework: Gaia
- MVC Frameworks and 404s
Leave a Comment
You must be logged in to post a comment.


![Creating A Php5 Framework Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_b.png?x-id=4df3c867-814e-48ad-acb9-e74166c709a4)















