Download the PHP package dekyfin/easypdo without Composer
On this page you can find all versions of the php package dekyfin/easypdo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dekyfin/easypdo
More information about dekyfin/easypdo
Files in dekyfin/easypdo
Package easypdo
Short Description A convenient wrapper for PDO. Supports only MySQL at the moment
License MIT
Informations about the package easypdo
EasyPDO
A convenient wrapper for PDO. Supports only MySQL at the moment. It is meant to simplify common queries in order to reduce the code to be written.
Example
What Can EasyPDO Do?
- Convenient wrappers for all CRUD operations
- SELECT
- UPDATE
- INSERT
- DELETE
- INSERT/UPDATE
-
Easily get the insertId for INSERT, affected rows for UPDATE/DELETE, and array of rows for SELECT statements.
- Use plain old PDO anytime you want
Installation
Composer
Manual
- Download the zip file
- Include
src/DB.php
into your pr
Usage
Methods
select( string $table, array $conditions = [] , mixed $modifiers ): array $rows
Used to select rows matching some $conditions
. This method currently selects all columns. It will be modified in v2.x.x to allow specifying of columns
$conditions
An associative array of$column => $value
to match against. Uses SQLAND
operator to match all$conditions
$modifiers
int || string- An integer will limit the number of results. Results in
LIMIT BY $modifiers
- A string which will be put at the end of the query to modify the behaviour. Example:
ORDER BY id DESC
- An integer will limit the number of results. Results in
insert( string $table, array $values ): int $insertId
update( string $table, array $values = [] [, array $conditions] ): int $rowCount
insertUpdate( string $table, array $values ): int insertId
Note: This method will return the insertId of the row if insert or update worked successfully
delete( string $table, array $conditions): int $rowCount
query( string $sql , boolean $fetchAll = false )
This function is used to run an sql query. Returns array of data if $fetchAll is true, and a PDOStatement object if false
execute( string $sql, array $values , boolean $fetchAll = false )
Used to prepare and execute a statement. Useful for running a one-off prepared statement. Returns array of data if $fetchAll is true, and a PDOStatement object if false