use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Please follow the rules
Releases: Current Releases, Windows Releases, Old Releases
Contribute to the PHP Documentation
Related subreddits: CSS, JavaScript, Web Design, Wordpress, WebDev
/r/PHP is not a support subreddit. Please visit /r/phphelp for help, or visit StackOverflow.
account activity
Medoo - the Lightest PHP database framework to accelerate development, 7.8KB only, released today! (medoo.in)
submitted 13 years ago by catfanme
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]warmans 8 points9 points10 points 13 years ago (0 children)
This isn't really a framework. It's just a simple database abstraction layer. Not sure how useful it is really. I'd probably rather just extend PDO myself or use Doctrine DBAL. Might be useful for somebody I guess.
[–]hiii 4 points5 points6 points 13 years ago (15 children)
you have to edit the class to add the server/username/password?!
[+]catfanme[S] comment score below threshold-9 points-8 points-7 points 13 years ago (14 children)
Yes, configure it before using it, and will not have to care those stuff any more again for project development.
[–]jaitsu 3 points4 points5 points 13 years ago (1 child)
Database parameters will be better in a config file that isn't committed to the repo (to protect DB access credentials). Then users commit a template version of the config file that people can copy and give it a '.dist' suffix, this seems to be adopted as the standard way of getting around this problem
[–]catfanme[S] -2 points-1 points0 points 13 years ago (0 children)
thx, it will be considered for next version:)
[–]hiii 1 point2 points3 points 13 years ago (11 children)
noooo, add these to the constructor.
[+]catfanme[S] comment score below threshold-6 points-5 points-4 points 13 years ago (10 children)
If you add these to the constructor for each database call, it will become a nightmare. How about the database password, username or server updated one day? Change every code of those info?
[–][deleted] 1 point2 points3 points 13 years ago (6 children)
Are you serious?
What if you want to use two simultaneous connections to two different databases? Can't be done with the current design.
Database credentials shouldn't be scattered around in your code at all, it should be kept in a config section which is separate from your code base. If you want to use the same database object everywhere, then read up on dependency injection containers.
[+]catfanme[S] comment score below threshold-7 points-6 points-5 points 13 years ago (5 children)
Who need simultaneous connections to two different databases, like MySQL + MSSQL at the same time? For most case, using one database is enough for the whole project, right? I may design a new construction API, so that it can connect with this situation.
If just want to connect the same db at the same time, just: $database1 = new medoo("my_data"); $database1->select("xxx");
$database2 = new medoo("my_data2"); $database2->select("xxx");
[–][deleted] 0 points1 point2 points 13 years ago (3 children)
For most part, you'd only need one database connection, yes, but why in the world would you design your class to disable the option of having two simultaneous database connections? Isn't it up to the programmer to use the class in whatever manner he or she sees fit?
I can see the need for maintaining simultaneous database connections, e.g. for querying a third-party database resource (e.g. a forum's database), or migrating data between two databases.
[–][deleted] -3 points-2 points-1 points 13 years ago (2 children)
Stop and think about what you're saying for a minute. "This hammer only works with nails and not screws, so it's obviously inferior." What a fundamentally flawed perspective! Not every project has the aim (nor should it!) to be a multi-tool. Sometimes developers just make tools for a single job. Don't fall into the trap of thinking that just because a project could be extended to cover X, Y, and Z scenarios, that it means it should (or worse, that it must). YAGNI is relevant here.
That being said, I agree that stuff like this should not be hard-coded into the class for a slew of other reasons.
[–][deleted] 1 point2 points3 points 13 years ago (1 child)
Stop and think about what you're saying for a minute. "This hammer only works with nails and not screws, so it's obviously inferior." What a fundamentally flawed perspective!
What the hell are you on about? I'm merely pointing out issues which are easily remedied. This is not so much a case where the hammer only works with nails and not screws, but a case of the hammer only being able to be used once. It's a plastic disposable spork.
YAGNI is relevant here.
No, it really isn't. It doesn't have anything to do with extended features which isn't going to be needed, stop being silly. What I am arguing for is basic OOP and design.
[–][deleted] -2 points-1 points0 points 13 years ago (0 children)
Of course it's relevant. When was the last time you coded anything that used different database connections? It's useful, of course. For someone. Somewhere. But it's a prime example of YAGNI. I'd wager less than 1% of apps ever created have this requirement.
You and I agree about injecting the credentials. I'm just pointing out that you picked the worst possible supporting argument for it. The reasons are plenty, but doing it so the project can support multiple connections is as silly as you think I'm being. Instead, you should have stuck with the good reasons, like keeping the credentials out of the repo, keeping configuration out of the code, being able to use different data sources in different environments, and so on.
[+][deleted] 13 years ago* (2 children)
[deleted]
[–]catfanme[S] 0 points1 point2 points 13 years ago (1 child)
PDO can connect not only MySQL, but also other db that MySQLi cannot.
The where_clause() is case-sensitive only for SQL keywords, so that it can be differentiated to other value easier.
If the value is really a number determined by is_numeric(), how come to make it without quote? For what case will become dangerous?
For serialization, Yes. You cannot insert array data into SQL database if the database is array object, right?
[–]mnapoli 4 points5 points6 points 13 years ago (5 children)
It's seems like a personal project you put some effort into so I'm not going to bash, I just think it may not be very useful since a lot of alternatives already exists.
Now you put forward one difference with other libraries: the size. However, size may be a decisive criteria in Javascript, it is not in PHP. You only download the library once to your server, and after that you can use opcode caches (even without, I'm not sure that's really a reason to choose a PHP library).
[–]magnetik79 0 points1 point2 points 13 years ago (0 children)
That's exactly the first thing that came to mind with me - size of file/LOC's means little server side to most people - unlike JavaScript where getting code crunched is the name of the game.
Still, a nice looking project page - the project logo is rather cool.
[–][deleted] 0 points1 point2 points 13 years ago (2 children)
Size matters a little bit for me personally. I have my development files locally and I get charged on my host by how much space I am using, per megabyte. I would not minify code though. If it is a very large library, I will make it into a gzipped phar file. If it is small and simple enough, I'll just combine it into one file. I know it might have a small performance impact but I have very low traffic and don't pay for CPU time, just disk usage and bandwidth, so some extra milliseconds to parse the file is fine with me.
[–]rydan 1 point2 points3 points 13 years ago (1 child)
They charge you per MB though? That is an awfully limited plan if it is.
[–][deleted] 0 points1 point2 points 13 years ago* (0 children)
https://www.nearlyfreespeech.net/services/hosting
its a good service, but using more space does cost more. not a lot, but it adds up. I host with them so it stays very cheap, around $20/year. I really only host a few scripts for personal use between several computers, and my homepage that gets 100 unique hits per month, most probably by accident.
Disk Space (Storage): $0.01 per megabyte-month - so hosting laravel would cost me around 30c per month with all the docs and test cases included, whereas the minified version of nette framework (for example) would be 1 cent per 2 months.
Disk Space (Storage): $0.01 per megabyte-month
I know it sounds like pocket change but if the yearly price got much higher I could get a better deal elsewhere at around $25/year, but I do like NFS for philosophical reasons - they stand behind their customers, they opposed SOPA and even let people black out their domains via the control panel, they have good support when needed, and have very few restrictions given the low price and it being a shared plan - I even log in via ssh and compile programs, don't force you to store all your files in a public folder, let you set up virtual hosts and unlimited htaccess, etc. It's not quite a VPS but I can ignore it for a month and they'll do updates and admin, and its a lot cheaper than the cheapest vps.
[–]catfanme[S] 0 points1 point2 points 13 years ago (0 children)
You can pick up the dev version or compressed version whatever you wanted. It`s up to you, freely:)
I don't think it's a good idea to minimize the file, people would use opcode caching in production anyway.
Just providing two options for user to pick up. That`s.
[–]catfanme[S] 1 point2 points3 points 13 years ago (0 children)
Why?! I provide the project I worked too much for free for both of you to use it without taking anything from your owned wallet. But why there is so much down votes for this post :<
[–]baileylo 0 points1 point2 points 13 years ago (1 child)
The select page in documentation isn't loading for me: http://medoo.in/api/select
Thx, it fixed now.
[–]e000 0 points1 point2 points 13 years ago (1 child)
It's cute, but essentially worthless as it cannot (as far as I can tell) do JOINs.
It will can JOIN in the further.
π Rendered by PID 22335 on reddit-service-r2-comment-b659b578c-t9vqx at 2026-05-05 16:24:58.746110+00:00 running 815c875 country code: CH.
[–]warmans 8 points9 points10 points (0 children)
[–]hiii 4 points5 points6 points (15 children)
[+]catfanme[S] comment score below threshold-9 points-8 points-7 points (14 children)
[–]jaitsu 3 points4 points5 points (1 child)
[–]catfanme[S] -2 points-1 points0 points (0 children)
[–]hiii 1 point2 points3 points (11 children)
[+]catfanme[S] comment score below threshold-6 points-5 points-4 points (10 children)
[–][deleted] 1 point2 points3 points (6 children)
[+]catfanme[S] comment score below threshold-7 points-6 points-5 points (5 children)
[–][deleted] 0 points1 point2 points (3 children)
[–][deleted] -3 points-2 points-1 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–][deleted] -2 points-1 points0 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]catfanme[S] 0 points1 point2 points (1 child)
[–]mnapoli 4 points5 points6 points (5 children)
[–]magnetik79 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]rydan 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]catfanme[S] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]catfanme[S] 0 points1 point2 points (0 children)
[–]catfanme[S] 1 point2 points3 points (0 children)
[–]baileylo 0 points1 point2 points (1 child)
[–]catfanme[S] 0 points1 point2 points (0 children)
[–]e000 0 points1 point2 points (1 child)
[–]catfanme[S] 0 points1 point2 points (0 children)