2017 © Pedro Pelรกez
 

library query-locator

A SQL query locator

image

koriym/query-locator

A SQL query locator

  • Monday, February 5, 2018
  • by koriym
  • Repository
  • 2 Watchers
  • 7 Stars
  • 5,650 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 9 Versions
  • 6 % Grown

The README.md

Koriym.QueryLocator

Scrutinizer Code Quality codecov Continuous Integration, (*1)

Koriym.QueryLocator is a PHP library that helps you manage SQL queries by locating and loading them from the file system. This approach simplifies query management and enhances code readability., (*2)

Installation

Install the library using Composer:, (*3)

$ composer require koriym/query-locator

Usage

Basic Example

To use the QueryLocator class, instantiate it with the directory where your SQL files are stored. You can then retrieve queries using keys that correspond to the directory structure., (*4)

SQL Files Directory Structure, (*5)

โ””โ”€โ”€ sql
    โ””โ”€โ”€ admin
        โ””โ”€โ”€ user.sql

Code Example, (*6)

use Koriym\QueryLocator\QueryLocator;

// Define the directory where your SQL files are stored
$sqlDir = 'path/to/sql/files';

// Instantiate the QueryLocator
$query = new QueryLocator($sqlDir);

// Retrieve a query
$sql = $query['admin/user']; // This will load the contents of 'admin/user.sql'

// Retrieve a count query
$countSql = $query->getCountQuery('admin/user'); // This will generate 'SELECT COUNT(*) FROM user'

Features

  • File-Based Query Management: Store your SQL queries in separate files for better organization.
  • Simple Query Retrieval: Use directory-based keys to retrieve queries.
  • Count Query Generation: Automatically generate count queries.

Benefits

  • Improved Readability: Keep your PHP code clean and readable by moving SQL queries to dedicated files.
  • Easy Maintenance: Modify your SQL queries without changing the PHP code, just update the SQL files.
  • Structured Organization: Organize your queries in a directory structure that makes sense for your application.

The Versions

05/02 2018

dev-patch-1

dev-patch-1

A SQL query locator

  Sources   Download

MIT

The Development Requires

sql

07/08 2017

1.x-dev

1.9999999.9999999.9999999-dev

A SQL query locator

  Sources   Download

MIT

The Development Requires

sql

06/06 2017

dev-updat-ci-files

dev-updat-ci-files

A SQL query locator

  Sources   Download

MIT

The Development Requires

sql

29/01 2016

1.3.0

1.3.0.0

A SQL query locator

  Sources   Download

MIT

The Development Requires

sql

17/12 2015

1.2.1

1.2.1.0

A SQL query locator

  Sources   Download

MIT

The Development Requires

sql

08/12 2015

1.1.0

1.1.0.0

A SQL query locator

  Sources   Download

MIT

The Development Requires

sql

08/12 2015

1.2.0

1.2.0.0

A SQL query locator

  Sources   Download

MIT

The Development Requires

sql

02/11 2015

0.1.0

0.1.0.0

A SQL query locator

  Sources   Download

MIT

sql

02/11 2015

1.0.0

1.0.0.0

A SQL query locator

  Sources   Download

MIT

sql