Archive for the ‘design pattern’ Tag
A simple MVC framework
I will describe in the following post a (very) simple MVC framework. You can download the source code from here or can make a copy from bitbucket repository.
As you can see, we have the following folders:
– web: here resides your public files (images, css, and index.php)
– app: here you can find application files: models, views, controllers (MVC)
Singleton Pattern
This pattern is probably one of the most simple and used pattern. As php manual says: The Singleton pattern applies to situations in which there needs to be a single instance of a class. The most common example of this is a database connection. Implementing this pattern allows a programmer to make this single instance easily accessible by many other objects.
There are tons of information about this pattern over the Internet so I let you google for it.
You can find a singleton implementation in Simple MVC framework example.