Jump to content

Looking for a PHP OOP PDO Framework


Supervan

Recommended Posts

Hi

 

I’m looking for a standalone PHP OOP framework or code that follows best practices

using 
             -  PDO prepared statements

             -  Singleton Design Pattern

 

Not looking for a massive library, something short and sweat straight to the point

 

 

Any comments, feedback would be appreciated

Edited by Supervan
Link to comment
Share on other sites

Does one really need a "PDO framework"? PDO is pretty simple to understand, and requires only a few statements to use. It's a set of functions that does everything you need. What will a framework accomplish for you that your own code can't do?

 

Guess I never understand why people here are always looking for ways to encapsulate a basic feature of web development with some 'tool' (framework in this case, object/classes in others) when the standard php language promises so much. You write a statement and prepare it, then you assign your parameter values via either a bind or an array to be used in the execute() call and then you loop thru the results with a simple while calling a fetch. Oh - and the connection is a short set of code that you write once and store off-root and include wherever it is needed.

 

Just my $.02.

Link to comment
Share on other sites

PDO  is a full API that integrates and abstracts several different database connection types into a unified and standard interface. While it's not technically a framework, and I'm sure many here would disagree with my statement, it's kind of close to a framework in itself - well, in a way that makes sense to me anyway, so there you go.

 

If you're looking for something a bit more abstracted with more convenience methods, bells, and whistles, you might want to check out the Doctrine Project DBAL classes.

Link to comment
Share on other sites

Does one really need a "PDO framework"? PDO is pretty simple to understand, and requires only a few statements to use. It's a set of functions that does everything you need. What will a framework accomplish for you that your own code can't do?

 

Guess I never understand why people here are always looking for ways to encapsulate a basic feature of web development with some 'tool' (framework in this case, object/classes in others) when the standard php language promises so much. You write a statement and prepare it, then you assign your parameter values via either a bind or an array to be used in the execute() call and then you loop thru the results with a simple while calling a fetch. Oh - and the connection is a short set of code that you write once and store off-root and include wherever it is needed.

 

Just my $.02.

Because using singletons and classes are like an MVC pattern. Coding it without an MVC pattern makes it hard to manage in the long run when you want to change something. Yes, you may think including just a file with database connections is uber easy because you don't have to do a lot of things. That's just being a lazy programmer. Also, singletons do the same thing, but it's safer because it doesn't execute the script without calling the class first. If you just include a database in a file, it's still being executed on the server side, but you don't see anything being done on the client side. This means it's going to waste resource because it's still using up resource, but just sitting there and being closed at the end of the PHP tag.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.