Download the PHP package harp-orm/query without Composer
On this page you can find all versions of the php package harp-orm/query. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package query
Harp Query
A query builder library, extending PDO to allow writing queries in object oriented style. Intelligently manages passing parameters to PDO's execute.
Quick usage example
The query execute()
method will generate a PDOStatement object that can be iterated over. All the variables are passed as position parameters ("seller = ?") so are properly escaped by the PDO driver.
Why?
PHP has quite a lot of excellent query builder classes already. For example Paris/Idiom, Kohana Query Builder etc. Why have another one? Here is my elevator pitch:
- Integrate with PDO - since it already has quite a lot of support for different DB drivers, harp-orm/query can use all that wealth of functionality out of the box. The base DB class extends PDO class, and the select result is actually PDOStatement object. And all of this already has great docs
- Use PSR coding standards and Symfony naming conventions for more familiar and readable codebase.
- Use PSR logging to integrate with any compatible logger.
- Support more rarely used SQL constructs, e.g. INSERT IGNORE, UNION, UPDATE JOIN etc.
- Precise methods to express intent more clearly e.g. methods like where, whereIn, whereLike allow you to write exactly what you intend, and not expect guesswork from the library. This can provide more error-free codebase.
- Fully covered with DockBlocks so static code analysis on packages built on top of it can be more accurate
- Full test coverage
Connecting to the database
Connecting to the database is a done with the "DB" object. It lazy loads a PDO connection object, and has the same arguments.
You can set some additional option for the DB object
Retrieving data (Select)
Tretrieve data from the database, use Select class.
An example select:
Inserting data (Insert)
Tretrieve insert new data to the database, use Insert class.
An example insert:
Deleting data (Delete)
Tretrieve delete data from the database, use Delete class.
An example delete:
Updating data (Update)
Tretrieve update data in the database, use Update class.
An example update:
Detailed docs
- Select
- Insert
- Delete
- Update
- Union
License
Copyright (c) 2014, Clippings Ltd. Developed by Ivan Kerin as part of clippings.com
Under BSD-3-Clause license, read LICENSE file.