Jump to content

My PHP Framework


Liquid Fire

Recommended Posts

http://apex-wowguild.com/uploads/files/codereck.zip

 

I am releasing my PHP frameowrk i am developing.  The current name of it is Codereck.  This is my first release and feel I could use this in production if need.  This frameowrk however is still in an infant stage right now.  While the code is ready for production use(I feel), the frameowrk is right now very minimalistic in what it can do.  I basically am using this as the starting point and will slow build up the functionality inside the framework.  The framework contains the follow:

 

database class(Right bnow only fully supports/tested on MySQL)

base data class(for build objects the get/send data to a database)

base file class(for build file like excel files)

email class(uses phpmailer for sending the email)

xhtml class

xhtml table class

benchmark class

logger class

 

These are some of the thing i need to do all of the time at work so these made it into the first release.  I am also designing a project management system and will use this framework to develop it.  This is going to be the main way for me to figure out what else the framework need and continue its developmenet.  Some of the planned features i will add are:

 

implement some sort of model/view system(high)

being able to load a object from a form to save a data object easily(high)

develop and test database class to fully work with both MSSQL and PostgreSQL(low)

enhance benchmark class(medium)

 

Now if some of you have the time and want to help me out it would be great if you can download and look at the code to see what you think i am missing or if you have the time, try to actually set it up and try to work with it, that would great help to me, it is just one config file.

 

http://apex-wowguild.com/uploads/files/codereck.zip

Link to comment
Share on other sites

I've looked quickly through your database.class, base.class and base_data.class. How come you put your fields all the way to the bottom? I always thought they should be put at the top of the class. When I opened your database class I only saw functions at first, and didn't know what field you were using or had at you disposal, and the database base class is quite long and the fields all all the way to the bottom.

 

I just wanted to ask that.

 

Sorry couldn't be more insightful.

 

 

Link to comment
Share on other sites

A bit nit picky but, one thing I noticed straight away is the spaces in the root directory name. This is a big no no, especially if your planning on distributing this thing. Makes life all the more difficult on Linux.

 

Anyway, I would say this is more of a library then a framework. There doesn't appear to be any code to actually process a request into a response. While a big part of a framework is its libraries, in my opinion it also needs to handle the request -> reponse delivery in a structured manor.

Link to comment
Share on other sites

Also what do you mean by "process a request into a response"?

 

There is no framework in place that can accept a request (eg; http://mydomain.com/blog/) and return the response (eg; the blog page). This is generally handled by something like the MVC pattern.

 

Without this simple yet structured concept, its just a library of helper classes IMO.

Link to comment
Share on other sites

I do plan on adding some sort of MVC.  I have built a base_module class that right now only has a method for load_view().  The way I plan on working this stuff is like this:

 

Any component of the system that will possible need to display any information is going to extends from the base_module class.  Now inside the api folder of the site(not the framework code), there will be a views folder and inside the views folder will be a folder for every module.  For instance my project tracker is going to have user module which means inside the views folder I would have a user folder.  Inside that folder will hold all possible view files(currently PHP files).  Another thing to mention this that each view will be a method inside that modules class.  so for instance a view for my user module might be profile.  I would then have a page that links to:

 

http://my.domain.com/user/index.php?view=profile&username=rjzec

Which i might rewrite as:

http://my.domain.com/user/profile/rjzec

 

which would display that users profile(I am not sure if i need to do mod rewrite or if i can program some sort of php class to do this, anyone know if i can do this in php?). Another url might be:

 

http://my.domain.com/user/index.php?view=edit_profile&username=rjzec

Which i might rewrite as:

http://my.domain.com/user/edit_profile/rjzec

 

and I think you get the point.  Now inside the class thier would be a method called profile and one called edit_profile and so on.  I would then have methods inside the user_module class the generate the data so in the end my profile method would look like this:

 

public function profile($username);
{
    $user = new user();
    $user->load_by_username($username);
    if(empty($user))
    {
        //ERROR CODE invalid username - I am still in the process to creating my own error handling system
    }
    else
    {
        $this->load_view("profile.php", $user);
    }
{

 

and the load_view just takes the page and the data the page needs.

 

How does this method look like to you.  any suggestions you might have, please let me know.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.