Download the PHP package komeiji-satori/miner without Composer
On this page you can find all versions of the php package komeiji-satori/miner. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download komeiji-satori/miner
More information about komeiji-satori/miner
Files in komeiji-satori/miner
Package miner
Short Description A dead simple PHP class for building SQL statements. No manual string concatenation necessary.
License MIT
Homepage https://github.com/jstayton/Miner
Informations about the package miner
Miner
A dead simple PHP class for building SQL statements. No manual string concatenation necessary.
Developed by Justin Stayton while at Monk Development.
Requirements
- PHP >= 5.1.0
Installation
Composer
The recommended installation method is through
Composer, a dependency manager for PHP. Just add
jstayton/miner
to your project's composer.json
file:
More details can be found over at Packagist.
Manually
- Copy
src/Miner.php
to your codebase, perhaps to thevendor
directory. - Add the
Miner
class to your autoloader orrequire
the file directly.
Getting Started
Composing SQL with Miner is very similar to writing it by hand, as much of the syntax maps directly to methods:
Now that the statement is built,
returns the full SQL string with placeholders (?), and
returns the array of placeholder values that can then be passed to your database connection or abstraction layer of choice. Or, if you'd prefer it all at once, you can get the SQL string with values already safely quoted:
If you're using PDO, however, Miner makes executing the statement even easier:
Miner works directly with your PDO connection, which can be passed during creation of the Miner object
or after
Usage
SELECT
With Miner:
INSERT
With Miner:
REPLACE
With Miner:
UPDATE
With Miner:
DELETE
With Miner:
Methods
SELECT
INSERT
REPLACE
UPDATE
DELETE
OPTIONS
SET / VALUES
FROM
- from
- innerJoin
- leftJoin
- rightJoin
- join
- getFrom
- getFromAlias
- getFromString
- getJoinString
- mergeFromInto
- mergeJoinInto
WHERE
- where
- andWhere
- orWhere
- whereIn
- whereNotIn
- whereBetween
- whereNotBetween
- openWhere
- closeWhere
- getWherePlaceholderValues
- getWhereString
- mergeWhereInto
GROUP BY
HAVING
- having
- andHaving
- orHaving
- havingIn
- havingNotIn
- havingBetween
- havingNotBetween
- openHaving
- closeHaving
- getHavingPlaceholderValues
- getHavingString
- mergeHavingInto
ORDER BY
LIMIT
Statement
- execute
- getStatement
- getPlaceholderValues
- isSelect
- isInsert
- isReplace
- isUpdate
- isDelete
- __toString
- mergeInto
Connection
Feedback
Please open an issue to request a feature or submit a bug report. Or even if you just want to provide some feedback, I'd love to hear. I'm also available on Twitter as @jstayton.
Contributing
- Fork it.
- Create your feature branch (
git checkout -b my-new-feature
). - Commit your changes (
git commit -am 'Added some feature'
). - Push to the branch (
git push origin my-new-feature
). - Create a new Pull Request.