承接 koriym/query-locator 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

koriym/query-locator

Composer 安装命令:

composer require koriym/query-locator

包简介

Load and manage SQL queries from files

关键字:

README 文档

README

Scrutinizer Code Quality codecov Continuous Integration

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.

Installation

Install the library using Composer:

$ 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.

SQL Files Directory Structure

└── sql
    └── admin
        └── user.sql

Code Example

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.

统计信息

  • 总下载量: 326.53k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 0
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-11-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固