4

I have been using ezSQL for the last few years but feel it is outdated. Though I like the simplicity and I like the file based caching ability with json, for small result sets that is.

So starting a new project I was looking for suggestions on a better mysql class for php. I know the db will only be mysql so portability is not a requirement. I read about mysqli extension, pdo etc but just dont know which one would be best for my situation. The site does a lot more reads than writes, though there are times where there are a lot of writes in the admin tool to the db. I looked at doctrine but dont know if that is too "bloated" for what I need. Hopefully this isnt to vague. Any suggestions?

EDIT

The site isnt small, I would consider it a high traffic site with a lot of db queries.

hakre
  • 193,403
  • 52
  • 435
  • 836
John
  • 9,840
  • 26
  • 91
  • 137
  • not directly answer to your question but you can check PHP Frameworks. For example Yii Frameworks using active records and i think it's very good. – Eray Jun 19 '11 at 20:08
  • I'm used to using the DAAB (Data Access Application Blocks) in the Entity Framework for .NET, and I know I would love to find a database agnostic class for PHP along those lines. – stephenbayer Jun 19 '11 at 20:20
  • As the author of ezSQL I'm interested to know what you decide to move to and why. Another possibility is for you to fork ezSQL and take it to it to the next level of simplicity and scalability yourself (something that I don't have the time to do). It may be of interest to know that I use ezSQL on my start-up Pluggio.com and so far have had no reason to consider using anything else even with many mission critical paying customers. Also, I'm not sure moving to a new db layer brings you much in terms of optimization... the next step may well be to learn about mem-cached, sharding, etc. – Justin Vincent Jun 20 '11 at 05:19
  • @Justin Vincent First off thank you for building ezSQL it has served me really well. I only ask because I felt it was old, outdated and maybe something was better out there. Otherwise ezSQL is really nice and I love it a lot especially the file based caching. I myself dont have time to take it to the next level. – John Jun 24 '11 at 18:44

3 Answers3

1

What don't you like about ezSQL? I often wish there was something like it for other protocols/languages I encounter. Every syntax should be written like ezSQL, in my opinion.. It describes the operation to be performed, in as few words as is possible, in the clearest and most logical order. Do you actually have performance problems, or are you just worried that something better has come along? I agree that ezSQL is rarely mentioned, but I have yet to find anything that matches it's simplicity, conciseness, and function...

Alex Gray
  • 16,007
  • 9
  • 96
  • 118
  • I just feel its outdated otherwise I find it very easy to use especially the file cache based system. – John Jun 23 '11 at 01:35
  • If it ain't broke, don't fix it. And if ya like it... buy it flowers. – Alex Gray Jun 23 '11 at 04:03
  • 2
    In PHP 5.5 only mysqli and PDO will be supported, old_school mysql_query, mysql_fetch_assoc, etc functions will be deprecated. EzSQL still uses SQLite2 insead of SQLite3. Seems like it's not being updated well... – wintercounter Jan 14 '13 at 16:26
0

From what I know of ezSQL (via it's wordpress pendant) I would consider Doctrine as well as too much for the moment because it's a complete data mapper for the database whereas you might be more looking to how to move away from your recent use of ezSQL which I think is a good idea.

Bascially you might be interested in a data-access abstraction layer. That could be PDO as it's build in into PHP. Even if you don't need to change the database server, it will give you defined interfaces how to query and access the data.

As you build the site from scratch, I can suggest you consider using some lightweight framework. A good introduction in my eyes is When Flat PHP meets Symfony which shows how a webapp can generally benefit from patterns and a flexible design.

hakre
  • 193,403
  • 52
  • 435
  • 836
  • Im actually starting from scratch so I have the ability to start anew with whatever I want. I dont know what examples would work for you. All I do is call ezsql to connect to the db to use throughout the site and I pass the db object to classes that do specific queries such as create/read/update/delete – John Jun 19 '11 at 20:23
  • @John: Yeah read it while I was reviewing your question. Will add a suggestion as part of my answer. – hakre Jun 19 '11 at 20:27
  • I will take a look at that. The framework I was originally looking at was codeigniter. – John Jun 19 '11 at 21:04
  • Codeigniter has a database access layer, too. And inside it, they are using PDO as well. The link is worth to read regardless of which framework to choose. – hakre Jun 19 '11 at 21:06
0

From experience:

  • Doctrine - very easy to use I love doctrine query language - I never had to do initial setup though so im not sure how hard it is. It has very good community and lots of tutorials.
  • Propel - used for a bit. Does the job, very similar to doctrine. However, the documentation is very crap and community is very slack. I found that when I didn't know something it was quite hard to find an answer and often I had to post on Google forums.

Note: If you are starting from scratch you might want to look at some of the frameworks such as symfony+doctrine is a good combination, makes development a lot easier.

Links: - http://www.doctrine-project.org/ - http://www.propelorm.org/

Luke
  • 1,872
  • 20
  • 31
  • Yeah I have thought about an existing framework. My concern is I might get stuck using a framework. Meaning sometimes I get these really weird requests for features/functionality that I worry will be outside the scope of the "rules" of a framework. Or Im spending time trying to figure out how to make the framework work for what I need it to do. Its hard to explain, its frustrating for me as a developer that Im told we cant say no to any requests. – John Jun 19 '11 at 20:35
  • @John I understand what you mean. I'm was used to write simple and plain php and use my "own" standards etc. However, once my project became quite large I found it hard to manage without using some guidelines and structure. That's what framework gives you. Already you should be using some sort of MVC structure to keep it neat, using framework just means that you get a lot of backing and a lot of methods that will help you achieve it ***better***. I do agree with you though, at the beginning you will find that everything is taking a lot longer. Give it some time! – Luke Jun 19 '11 at 21:46
  • @John One plus of using framework along with doctrine for example is ease of adding new modules and changes to db (via command line or netbeans build in features). Everything is an object, its easy to manage its easy and logical to query them and my favourite unit testing. – Luke Jun 19 '11 at 21:48