Download the PHP package fractalizer/php-sweet-pdo without Composer
On this page you can find all versions of the php package fractalizer/php-sweet-pdo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fractalizer/php-sweet-pdo
More information about fractalizer/php-sweet-pdo
Files in fractalizer/php-sweet-pdo
Package php-sweet-pdo
Short Description Small, simple and convenient PDO wrapper
License CC-BY-NC-3.0
Informations about the package php-sweet-pdo
What is phpSweetPDO?
phpSweetPDO is a php PDO wrapper, which is:
- Extremly simple to use
- Phar package to ease deployment. You just need one 9Kb file to work with library (compressed phar)
- Compact (like 400 lines of commented code which you may compress even further)
- Optionally supports events, that allow easy profiling and debugging
Examples of use:
Events
If you pass an object of type Symfony\Component\EventDispatcher\EventDispatcher
to the constructor of Connection class, it will fire events on it's actions.
You can read more about event dispatcher here: http://components.symfony-project.org/event-dispatcher/documentation.
The following events can be tracked down:
- phpsweetpdo.connect.started / phpsweetpdo.connect.finished
- phpsweetpdo.execute.started / phpsweetpdo.execute.finished
- phpsweetpdo.select.started / phpsweetpdo.select.finished
- phpsweetpdo.get_one_value.started / phpsweetpdo.get_one_value.finished
- phpsweetpdo.get_one_row.started / phpsweetpdo.get_one_row.finished
- phpsweetpdo.begin_transaction.started / phpsweetpdo.begin_transaction.finished
- phpsweetpdo.commit_transaction.started / phpsweetpdo.commit_transaction.finished
- phpsweetpdo.rollback_transaction.started / phpsweetpdo.rollback_transaction.finished
Most events is accompanied by parameters. They are mostly sql (sql query which is executing), params (parameters, passed to query), and _driveroptions - driver options used, if any.
Limitations
phpSweetPDO does not support (at least yet, send pull requests):
- Typed PDO parameters. All params are passed as is to PDOStatement->execute() (For example, MySQL deals with type conversion itself. The same probably goes to many other database engines).
- Explicit output parameters. You cannot mark a parameter as output in phpSweetPDO call. But you can use a method described above in the examples section.
Requirements
- PHP 5.3 or higher (you can use lower versions, but the code will need to get cleaned from namespaces then).