views:

805

answers:

11

Hi,

I have been using Creole for a year, but Creole project is dead now..

what are other good abstractions for php ?

+7  A: 

I think the built-in PDO library might be what you're looking for.

musicfreak
+3  A: 

The PDO Abstraction Layer is compiled by default in to versions of PHP >= 5.1

Nick
+2  A: 

Beware, however, that PDO is not for systems where performance is the top goal. PDO is for situations where compatibility is the foremost concern.

"PDO is not for use on systems where mysql performance is a top goal" => http://dealnews.com/developers/php-mysql.html

If you are just using mysql, then you had better use the php_mysqli extension.

Here Be Wolves
Hmm, every other source I've read has PDO faster than mysql and mysqli.
musicfreak
Also, see the big "Update!" at the top of the page.
musicfreak
Hmm.. actually this link is not the only source of my info.. I've read many-a-place about PDO being slower. Only this link was in the top of my head... but maybe things have improved, eh? Afterall, PDO is supposed to be "light and fast".
Here Be Wolves
+4  A: 

Why don't you give ADODB a shot? It's pretty much an active project and supports an amazing number of databases:

  • MySQL
  • PostgreSQL
  • Interbase
  • Firebird
  • Informix
  • Oracle
  • MS SQL
  • Foxpro
  • Access
  • ADO
  • Sybase
  • FrontBase
  • DB2
  • SAP DB
  • SQLite
  • Netezza
  • LDAP
  • and generic ODBC, ODBTP etc.

It's got very simple syntax and the learning curve is quite low. Here's a small example from their site:

include('/path/to/adodb.inc.php');
$DB = NewADOConnection('mysql');
$DB->Connect($server, $user, $pwd, $db);

# M'soft style data retrieval with binds
$rs = $DB->Execute("select * from table where key=?",array($key));
while (!$rs->EOF) {
    print_r($rs->fields);
    $rs->MoveNext();
}

# PEAR style data retrieval
$rs = $DB->Execute("select * from table where key=123");
while ($array = $rs->FetchRow()) {
    print_r($array);
}

# Alternative URI connection syntax:
$DB = NewADOConnection("mysql://$user:$pwd@$server/$db?persist");

# No need for Connect or PConnect when using URI syntax

$ok = $DB->Execute("update atable set aval = 0");
if (!$ok) mylogerr($DB->ErrorMsg());

Cheers, miCRoSCoPiC^eaRthLinG

miCRoSCoPiC_eaRthLinG
Link seems invalid. Please correct.
this. __curious_geek
Thanks for pointing that out :)
miCRoSCoPiC_eaRthLinG
ADODB is also one of the fastest and most pragmatic libs you will find.
Jeff Ober
@Jeff Ober: Pragmatic, sure, but it's definitely not fast.
musicfreak
agreed with @musicfreak about speed, if you want to use something like that try AdoDB lite
Gabriel Sosa
A: 

You could always write your own. A singleton database handler should only be about 500 lines, including comments.

staticsan
You can allways code your own Operating System to go with it, but why bother? (Unless your Linus Thorvals)
Gerrit
+1  A: 

you could try dibi - dibiphp.com

+1  A: 

I'd go for Doctrine anytime.

phidah
A: 

Zend_Db from ZF is also very nice.

qeek
A: 

I used EZ SQL in the past, which really speeds up writing PHP/MySQL apps.

It is the SQL library used in Wordpress.

Will

William Macdonald
A: 

For PHP 5, have a look http://www.openmv.com/ (MV_Database_Connection), it's new but has a very portable and consistent well-tested api.

Very similar to ADODB but much cleaner code.

Jon
A: 

give a try to DALMP: http://code.google.com/p/dalmp/ is support prepared statements and many cache backends, besides being very fast

tareco