PHPackages                             tiny-queries/tiny-queries - 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. tiny-queries/tiny-queries

ActiveLibrary[Database &amp; ORM](/categories/database)

tiny-queries/tiny-queries
=========================

Highly efficient database layer as alternative for ORM - direct mapping from SQL to REST interface

v3.7.3(6y ago)23.1kApache-2.0PHPPHP &gt;=5.3.0

Since Apr 10Pushed 6y ago1 watchersCompare

[ Source](https://github.com/wdiesveld/TinyQueries)[ Packagist](https://packagist.org/packages/tiny-queries/tiny-queries)[ Docs](http://www.tinyqueries.com/)[ RSS](/packages/tiny-queries-tiny-queries/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)DependenciesVersions (62)Used By (0)

[![TinyQueries](https://camo.githubusercontent.com/24391896be3fd3d62beb3f1082859050a25a78a3ca21f81327c4d44597e50b38/687474703a2f2f74696e79717565726965732e636f6d2f6373732f696d616765732f74696e792d717565726965732d6c6f676f2d6c617267652e706e67)](http://www.tinyqueries.com/)

---

*This repo is **@deprecated** - please use  instead*

---

With TinyQueries you can create a REST API in which the endpoints are mapped directly to database queries, without an intermediate object layer. The queries can be created either by plain SQL or by a compiler which compiles object oriented notation into SQL. It's based on two components:

- A query compiler - it's like a Less for SQL, so you create SQL queries by compiling them.
- A simple and powerful syntax to combine the output of queries into nested structures.

Why
---

[](#why)

Although you can create REST API's with ORM frameworks as well, TinyQueries has several advantages:

- It's much faster than ORM.
- As a developer you are not bothered with setting up a complex object hierarchy.
- TinyQueries can be connected to any *existing* database, which is much harder with ORM.
- You still have the advantage of object oriented notation for queries.
- You still have all freedom to do *any* SQL you want - even in object notation - which is impossible with ORM.

System Requirements
-------------------

[](#system-requirements)

- PHP 5.3 or higher
- PHP's PDO database layer should be installed
- PHP's cURL lib should be enabled
- A SQL database

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

[](#installation)

NOTE: This package is especially usefull if you want to integrate TinyQueries with an existing PHP application. However if you want to start from scratch it's recommended to use [TinyQueries API version](https://github.com/wdiesveld/tiny-queries-php-api) instead which requires less configuration.

1. If you use Composer then update your composer.json file as follows:

    `composer require tiny-queries/tiny-queries:^v3`

    Alternatively, instead of using Composer you could just download the ZIP-file and put the content in the folder where you put your libs.
2. Create a folder `queries` in your project folder. Within this folder create three subfolders `sql`, `interface` and `tiny`. So you have:

    - `queries` the main query folder
    - `queries/interface` this folder will be used to store compiled json files
    - `queries/sql` this folder will be used to store compiled SQL files
    - `queries/tiny` this folder will be used to store your TinyQueries source files

    Ensure that this folder is not accessible through http (so in case you use Apache add a .htaccess file)
3. Use the file `config/config.template.xml` to set the database credentials and save it as `config/config.xml`.
4. In `config.xml` you should specify the path to the folder `queries/tiny` in ``
5. In `config.xml` you should specify the path to the folder `queries` in ``
6. Create a file `_model.json` inside the folder `queries/tiny` which has the following content:

    ```
    /**
     * Model for my project
     *
     */
    {
    }
    ```
7. Create a file `_project.json` inside the folder `queries/tiny` which has the following content:

    ```
    /**
     * Projectfile
     *
     */
    {
    	id: "my-project"
    }
    ```

Your project is now ready to be compiled. You can choose to compile using the online IDE or compile from the commandline. Please check  for more info.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~30 days

Recently: every ~210 days

Total

61

Last Release

2231d ago

Major Versions

v2.8.9 → v3.0b2015-12-31

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3285079?v=4)[Wouter Diesveld](/maintainers/wdiesveld)[@wdiesveld](https://github.com/wdiesveld)

---

Top Contributors

[![wdiesveld](https://avatars.githubusercontent.com/u/3285079?v=4)](https://github.com/wdiesveld "wdiesveld (343 commits)")

---

Tags

databaseormsqlpdocompiler

### Embed Badge

![Health badge](/badges/tiny-queries-tiny-queries/health.svg)

```
[![Health](https://phpackages.com/badges/tiny-queries-tiny-queries/health.svg)](https://phpackages.com/packages/tiny-queries-tiny-queries)
```

###  Alternatives

[morris/lessql

LessQL: A lightweight and performant PHP ORM alternative

405140.0k3](/packages/morris-lessql)[ramadan/easy-model

A Laravel package for enjoyably managing database queries.

101.6k](/packages/ramadan-easy-model)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
