tiny-queries / tiny-queries
Highly efficient database layer as alternative for ORM - direct mapping from SQL to REST interface
Installs: 3 109
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/tiny-queries/tiny-queries
Requires
- php: >=5.3.0
- ext-curl: *
- ext-mbstring: *
- ext-pdo: *
- ext-xml: *
- dev-master
- v3.7.3
- v3.7.2
- v3.7.1
- v3.7.0
- v3.6.3
- v3.6.2
- v3.6.1
- v3.6.0
- v3.5.2
- v3.5.1
- v3.5.0
- v3.4.1
- v3.4.0
- v3.3.1
- v3.3.0
- v3.2.5
- v3.2.4
- v3.2.3
- v3.2.2
- v3.2.1
- v3.2.0
- v3.1.5
- v3.1.4
- v3.1.3
- v3.1.2
- v3.1.1
- v3.1.0
- v3.0.7
- v3.0.6
- v3.0.5
- v3.0.4
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0
- v3.0b
- v2.8.9
- v2.8.8
- v2.8.7
- v2.8.6
- v2.8.5
- v2.8.4
- v2.8.3
- v2.8.2
- v2.8.1
- v2.8
- v2.7.2
- v2.7.1
- v2.7
- v2.6.1
- v2.6
- v2.6a
- v2.5.6
- v2.5.5
- v2.5.4
- v2.5.3
- v2.5.2
- v2.5.1
- v2.5
- v2.5-RC2
- v2.5-RC1
This package is auto-updated.
Last update: 2025-10-23 18:13:43 UTC
README
This repo is @deprecated - please use https://github.com/querytechnology/tqc-php 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
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
- PHP 5.3 or higher
- PHP's PDO database layer should be installed
- PHP's cURL lib should be enabled
- A SQL database
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 instead which requires less configuration.
-
If you use Composer then update your composer.json file as follows:
composer require tiny-queries/tiny-queries:^v3Alternatively, instead of using Composer you could just download the ZIP-file and put the content in the folder where you put your libs.
-
Create a folder
queriesin your project folder. Within this folder create three subfolderssql,interfaceandtiny. So you have:queriesthe main query folderqueries/interfacethis folder will be used to store compiled json filesqueries/sqlthis folder will be used to store compiled SQL filesqueries/tinythis 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)
-
Use the file
config/config.template.xmlto set the database credentials and save it asconfig/config.xml. -
In
config.xmlyou should specify the path to the folderqueries/tinyin<compiler input="[path-to-queries-tiny-folder]" /> -
In
config.xmlyou should specify the path to the folderqueriesin<compiler output="[path-to-queries-folder]" /> -
Create a file
_model.jsoninside the folderqueries/tinywhich has the following content:/** * Model for my project * */ { }
-
Create a file
_project.jsoninside the folderqueries/tinywhich 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 http://docs.tinyqueries.com for more info.