hamaryuginh/meekrodb-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

A Symfony2 Bundle for MeekroDB

Maintainers

👁 hamaryuginh

Package info

github.com/hamaryuginh/meekrodb-bundle

Type:symfony-bundle

pkg:composer/hamaryuginh/meekrodb-bundle

Statistics

Installs: 76

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-master / 1.0.x-dev 2014-10-29 11:55 UTC

Requires

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 8cb96f679731206f87d5b52002f0b97b3e1a1f0e

  • hamaryuginh <hamaryuginh.woop@gmail.com>

databaseSymfony2dbbundleupdateinsertselectdeletemeekrodb

This package is not auto-updated.

Last update: 2020-02-13 23:21:28 UTC


README

A symfony2 bundle for MeekroDB.

Installation

Add the bundle to your composer.json

{
 "require": {
 "...",
 "hamaryuginh/meekrodb-bundle": "dev-master"
 }
}

Run composer install

php composer.phar install

Enable the bundle in the kernel

<?php
// app/AppKernel.php

public function registerBundles()
{
 $bundles = array(
 // ...
 new Hamaryuginh\MeekroDbBundle\HamaryuginhMeekroDbBundle(),
 );
}

Configuration

Add configuration to config.yml.

# config.yml

hamaryuginh_meekro_db:
 meekrodb:
 connections:
 my_db_host_1:
 host: database_host # default value is "localhost"
 port: 6666 # default value is 3306
 encoding: utf8 # default value is utf8
 db_name: database_name
 user: database_user
 password: user_password # default value is ""
 my_db_host_2: # you can set multiple host
 ...

Now you're all set, you can now use the bundle as following:

Use

<?php
// In a controller

$dbManager = $this->get('hamaryuginh.meekro_db');
$myDbHost = $dbManager->get('my_db_host'); // The name of the connection
$account = $myDbHost->query("SELECT * FROM accounts WHERE username=%s", 'Joe');