Supervan Posted April 20, 2015 Share Posted April 20, 2015 (edited) 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 April 20, 2015 by Supervan Quote Link to comment Share on other sites More sharing options...
ginerjm Posted April 20, 2015 Share Posted April 20, 2015 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. Quote Link to comment Share on other sites More sharing options...
maxxd Posted April 20, 2015 Share Posted April 20, 2015 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. Quote Link to comment Share on other sites More sharing options...
PHPEnthusiast Posted April 21, 2015 Share Posted April 21, 2015 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. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted April 21, 2015 Share Posted April 21, 2015 phpenthusiast - Huh?? Quote Link to comment Share on other sites More sharing options...
Supervan Posted April 21, 2015 Author Share Posted April 21, 2015 (edited) Thanks to all, who have commented... OOP gives structure to php and code reuse ability Edited April 21, 2015 by Supervan Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.