Practical PHP Database Wrapper: Crystal
3
Jan
// php the_time('Y') ?>
Crystal is a database toolkit for PHP which aims to help developers build & scale reusable, database-dependent, framework-agnostic applications.
It has 3 independent components:
- Database wrapper – for CRUD operations
- Validation module – provides a comprehensive data validation
- Database manipulation module – used for creating databases, tables, etc.
The queries written with Crystal are database-independent which currently supports MySQL & PostgreSQL (SQLite is on the way).
For anyone who is familiar with SQL, learning Crystal wouldn't take no more than 5 minutes.
And, for many developers, it can be an option against framework-specific database layers like Zend_Db and Codeigniter's active record library or complex ORM's like Doctrine.
Requirements: PHP 5.24+
Compatibility: MySQL, PostgreSQL (SQLite coming soon)
Website: http://crystal.martinrusev.net/
Download: http://crystal.martinrusev.net/index.php/download/la...
Compatibility: MySQL, PostgreSQL (SQLite coming soon)
Website: http://crystal.martinrusev.net/
Download: http://crystal.martinrusev.net/index.php/download/la...
- Tags:
Mysql Php PostgreSQL SQLite
- Filed under: Database, Goodies, MIT License
- 12 Comments
















12 Responses for "Practical PHP Database Wrapper: Crystal"
seems nice. was looking for a component like this.
Looks impressive! Anyone used this yet?
I can’t seem to get the fetchAll function to work for me.. anyone else having any similar issues..
Hi, I saw the problem with the fetch_all() function. You can download the 0.3 branch from github – http://github.com/martinrusev/Crystal/tree/0.3
I am working on a fix and I will release version 0.2.2 after a few hours.
Best regards,
Martin Rusev
Cheers Martin!! Thanks for the quick response – I have been looking for something like this for ages!! I am really impressed with everything you have done so far – I will be using this in the near future for certain..
Keep up the good work!
Looks nice. I am going to do some tests over the next few days. Thanks!
I can’t get the manipulation class to load. I keep getting Fatal error: Class ‘Crystal_Helper’ not found in includes\Crystal\Crystal\Manipulation\Mysql\Create.php on line 0
This bug is fixed in version 0.2.3. Also I am working on a bug tracker and I will add it to the site very soon.
Best Regards,
Martin Rusev
How safe is this? In the sense of SQL injection mainly, does it protect against it in the same manner as parametrized queries do?
Why you dont use the Php native solution PDO? It’s faster than every and has already a good way to build ‘secured’ query.
For instance in my framework I got something like
query(‘SELECT DISTINCT * FROM toto WHERE time = ?’,1243333);
query function has just 10 lines of code… Honestly your DB framework looks really “big” (91 files , 400Ko … ) ….
Nice concept, poorly written. Static methods all over, no documentation. Non-configurable database connection parameters except that in the file it comes with so no chance to include it in existent projects. Overall :it lacks that 5% to make it usable.
Have a look at Zebra_Database – an advanced, compact (one-file only), lightweight, MySQL database wrapper built upon PHP’s MySQL extension. It has a fantastic debug interface, supports transactions, and provides ways for caching query results either by saving cached data on the disk, or by using memcache. Also, has great documentation – http://stefangabos.ro/php-libraries/zebra-database/