PHPackages                             querytechnology/tqc - 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. querytechnology/tqc

ActiveLibrary

querytechnology/tqc
===================

Command line interface for the TinyQueries Compiler

v2.2.2(6y ago)18MITPHPPHP &gt;=7.0

Since Apr 23Pushed 6y ago1 watchersCompare

[ Source](https://github.com/querytechnology/tqc-php)[ Packagist](https://packagist.org/packages/querytechnology/tqc)[ Docs](https://www.tinyqueries.com)[ RSS](/packages/querytechnology-tqc/feed)WikiDiscussions master Synced 1w ago

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

tqc-php
=======

[](#tqc-php)

Command line interface written in PHP for the TinyQueries™ Compiler

Installation
------------

[](#installation)

- Make sure you have an API key for the TinyQueries™ Compiler. You can get one here: . You can choose to add `TINYQUERIES_API_KEY` to your ENV variables OR add it to the `.env` file of your project if you have one.
- Make sure you have PHP v7.0 or higher
- For Windows download the files `bin/tqc.phar` and `bin/tqc.bat` from this repo and put them in a folder which is in your PATH
- For Mac/Linux run these commands: ```
    wget https://github.com/querytechnology/tqc-php/raw/master/bin/tqc.phar
    sudo mv tqc.phar /usr/local/bin/tqc
    sudo chmod +x /usr/local/bin/tqc

    ```

Setup TinyQueries™ for your project
-----------------------------------

[](#setup-tinyqueries-for-your-project)

It is assumed you have a folder for your project. It can be an empty folder or a folder which contains other code as well.

- Create a folder inside your project folder (for example `tinyqueries`) in which you put your TinyQueries source queries
- Create a folder inside your project folder (for example `sql`) in which you want the compiler to put your compiled queries
- Create a config file `tinyqueries.json` or `tinyqueries.yaml` in the root of your project folder. For example:

```
project:
  label: your-project-label
compiler:
  dialect: mysql
  input: ./tinyqueries
  output: ./sql
```

For a more detailed description of config files please check

Compile your queries
--------------------

[](#compile-your-queries)

Once you have setup your project you just have to execute

```
tqc

```

from your project folder each time you want to compile your source files

Use the lib as PHP package
--------------------------

[](#use-the-lib-as-php-package)

If you want to call the TinyQueries™ Compiler from inside a PHP script, instead of from the command line, you can do that as follows:

```
composer require querytechnology/tqc

```

Example PHP file how to compile your queries:

```
