Download the PHP package sanderheijselaar/ezpdo without Composer

On this page you can find all versions of the php package sanderheijselaar/ezpdo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ezpdo

EZ PDO

Querying made simple & safe with PDO

Installation

Install the composer package (https://packagist.org/packages/sanderheijselaar/ezpdo) or download and include the ezPdo.php file in your project

Usage

Create new SimplePDO instance or use the existing one:

use SanderHeijselaar\EzPdo\EzPdo;

$dbh = new EzPdo(
    EzPdo::DB_TYPE_MYSQL, 
    'localhost', 
    'db_name', 
    'db_user', 
    'db_pass');

Drop an existing table:

$sql = "
    DROP TABLE IF EXISTS `person`;
";

$result = $dbh->update($sql,array());
var_export($result);

Create a new table:

$sql = "
    CREATE TABLE `person` (
        `id`  smallint UNSIGNED NOT NULL AUTO_INCREMENT ,
        `name`  char(32) NOT NULL ,
        `email`  char(64) NOT NULL ,
        `phone`  char(16) NOT NULL ,
        PRIMARY KEY (`id`)
    );
";

$result = $dbh->update($sql,array());
var_export($result);

Insert rows into the new table:

$sql = "
    INSERT INTO 
        `person` (`name`, `email`, `phone`) 
    VALUES 
        ('Simon', '[email protected]', '+31612345678');
";

$result = $dbh->insert($sql,array());
var_export($result);

$sql = "
    INSERT INTO 
        person` (`name`, `email`, `phone`) 
    VALUES 
        ('Sander', '[email protected]', '+31612345678');
";

$result = $dbh->insert($sql,array());
var_export($result);

$sql = "
    INSERT INTO 
        `person` (`name`, `email`, `phone`) 
    VALUES 
        ('Barry', '[email protected]', '+31612345678');
";

$result = $dbh->insert($sql,array());
var_export($result);

Retrieve all rows:

$sql = "
    SELECT 
        * 
    FROM 
        `person` 
    ORDER BY 
        `id` ASC;
";

$result = $dbh->getResults($sql,array());
var_export($result);

Update a row by id:

$sql = "
    UPDATE 
        `person` 
    SET 
        `phone` = :phone 
    WHERE 
        `id` = :id
";
$sqlData = array(
    'id'    => 1,
    'phone' => '+31688888888',
);

$result = $dbh->update($sql, $sqlData);
var_export($result);

Retrieve by column:

$sql = "
    SELECT `phone` FROM `person` ORDER BY `id` ASC;
";

$result = $dbh->getCol($sql,array());
var_export($result);

Delete a row by id:

$sql = "
    DELETE FROM `person` WHERE `id` = :id
";
$sqlData = array(
    'id'    => 2,
);

$result = $dbh->delete($sql, $sqlData);
var_export($result);

Select a column by id:

$sql = "
    SELECT `phone` FROM `person` WHERE `id` = :id;
";
$sqlData = array(
    'id'    => 1,
);

$result = $dbh->getVar($sql, $sqlData);
var_export($result);

Select multiple rows using the WHERE ... IN (...) statement with an array:

$sql = "
    SELECT `id` FROM `person` WHERE `phone` IN (:phone);
";
$sqlData = array(
    'phone' => array(
        '+31612345677',
        '+31612345678',
        '+31612345679',
        '+31688888888',
    ),
);

$result = $dbh->getCol($sql, $sqlData);
var_export($result);

Make a query that throws an EzPdoException:

try {
    $sql = "
        SELECT `phone` FROM `ERROR` WHERE `id` = :id;
    ";
    $sqlData = array(
        'id'    => 1,
    );

    $result = $dbh->getVar($sql, $sqlData);
    var_export($result);
} catch (SanderHeijselaar\EzPdo\EzPdoException $ex) {
    var_export($ex->getMessage());
}

Get the parsed query. Only use this for debugging queries:

try {
    $sql = "
        SELECT `phone` FROM `ERROR` WHERE `id` = :id;
    ";
    $sqlData = array(
        'id'    => 1,
    );

    $result = $dbh->returnParsedQuery($sql, $sqlData);
    echo $result;
} catch (SanderHeijselaar\EzPdo\EzPdoException $ex) {
    var_export($ex->getMessage());
}

Licensed under MIT


All versions of ezpdo with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sanderheijselaar/ezpdo contains the following files

Loading the files please wait ...