1. Go to this page and download the library: Download xwero/idable-queries-core library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xwero / idable-queries-core example snippets
`
$query = 'SELECT ~Users:Name, ~Users:Email FROM ~Users:Users WHERE ~Users:Id = :UsersId';
$namespaces = new BaseNamespaceCollection('Test\Identifiers');
$result = replaceIdentifiersInQuery($query, $namespaces)
|> (fn($query) => replaceParametersInQuery($query, new IdableParameterCollection(Users::Id, 1), $namespaces))
|> (fn($queryAndParameters) => someDatabaseFunction($queryAndParameters))
|> (fn($data) => createMapFromSecondLevelResults($data, $query, namespaces: $namespaces))
;
// with runChain
$query = 'SELECT ~Users:Name, ~Users:Email FROM ~Users:Users WHERE ~Users:Id = :UsersId';
$namespaces = new BaseNamespaceCollection('Test\Identifiers');
$result = runChain(new Chain(
fn() => replaceIdentifiersInQuery($query, $namespaces)
fn($query) => replaceParametersInQuery($query, new IdableParameterCollection(Users::Id, 1), $namespaces),
fn($queryAndParameters) => someDatabaseFunction($queryAndParameters),
fn($data) => createMapFromSecondLevelResults($data, $query, namespaces: $namespaces)
));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.