devtoolboxuk/storage

1.0.4 2019-03-15 21:53 UTC

This package is auto-updated.

Last update: 2024-11-16 20:52:36 UTC


README

Build Status Scrutinizer Code Quality Latest Stable Version Total Downloads License

Table of Contents

Background

Can be used to connect to storage engines such as MySQL

Usage

Usage of the hashing service

$ composer require devtoolboxuk/storage

Then include Composer's generated vendor/autoload.php to enable autoloading:

require 'vendor/autoload.php';

MySQL Connection

Basic example of accessing a database

use devtoolboxuk/storage;

$dbOptions = [
    'adapter' => 'mysql',
    'driver' => 'mysqli',
    'host' => '',
    'dbname' => '',
    'user' => '',
    'password' => '',
    'port' => '3306',
    'charset' => 'utf8
];
$storage = new StorageManager($dbOptions);
$conn = $storage->getAdapter()->connection();
$queryBuilder = $conn->createQueryBuilder();

$result = $queryBuilder
    ->select('id', 'name')
    ->from('users')
    ->execute();
print_r($result->fetchAll());

Maintainers

@DevToolboxUk.

License

MIT © DevToolboxUK