PHPackages                             beeflow/sqlquerymanager - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. beeflow/sqlquerymanager

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

beeflow/sqlquerymanager
=======================

SQLQuery Manager Util

1.2.1(6y ago)11.2k[4 PRs](https://github.com/beeflow/sqlquery/pulls)LGPL-3.0-or-laterPHPPHP &gt;=7.1

Since Apr 11Pushed 6y ago1 watchersCompare

[ Source](https://github.com/beeflow/sqlquery)[ Packagist](https://packagist.org/packages/beeflow/sqlquerymanager)[ Docs](https://github.com/beeflow/sqlquery)[ RSS](/packages/beeflow-sqlquerymanager/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (2)Versions (9)Used By (0)

Simple SQL query manager
========================

[](#simple-sql-query-manager)

A simple SQL query manager with option to secure queries by setting parameter type.

It uses classes which represents siple var types as string, integer etc... and own classes like secureString, email etc...

To better secure queries, you can create your own var types classes, for example password or phone

Install
-------

[](#install)

### composer

[](#composer)

```
$ composer require "beeflow/sqlquerymanager:dev-master"

```

### GIT

[](#git)

```
$ git clone https://github/beeflow/

```

and then add to `app/AppKernel.php`

```
public function registerBundles()
{
    ...
    new Beeflow\SQLQueryManager\SQLQueryBundle(),
}

```

To add new Vartype just insert into your `services.yml`

```
app.YourVarType:
    class: YourBundle\Lib\Vartypes\YourVarType;
    tags:
        - { name: beeflow.sql_manager.vartype, alias: yourVarTypeAlias }

```

and now you can use it in SQL query:

```
SELECT example1 FROM exampleTable WHERE example = {value->yourVarTypeAlias}

```

Examples
--------

[](#examples)

### SQL query example:

[](#sql-query-example)

```
SELECT example1 FROM exampleTable WHERE example = {value->secureString}

```

### Using SQLQueryManager as Symfony service

[](#using-sqlquerymanager-as-symfony-service)

In your Controller:

```
$sqlManager = $this->get('beeflow.sql_query_manager');

```

Set default directory with SQL files

```
$slqlManager->setSqlDirectory('sql_directory');

```

Use query as a method with temporary different directory with SQL files:

```
$slqlManager->sqlExample([
      'value'                  => 'TEST_VALUE',
      'value2'                 => 11,
      'vatno'                  => '1111111111',
      'valueArrayWithoutAtype' => array('one', 'two', 'tree')
], 'someTmpDirectory');

```

### Example with new method of calling SQL files

[](#example-with-new-method-of-calling-sql-files)

```
`
