rebelcode/atlas 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

rebelcode/atlas

Composer 安装命令:

composer require rebelcode/atlas

包简介

A lightweight SQL generation library.

README 文档

README

A lightweight SQL builder library that does not require a database connection.

GitHub Workflow Status Packagist PHP Version Support Packagist Version Packagist License

About

The primary goal for Atlas is to replace SQL strings in your codebase with immutable objects that can be safely shared between different parts of your application. Atlas is NOT an ORM! But queries can be executed by implementing a thin database adapter interface.

Atlas' design philosophy is simple: to mirror SQL syntax as closely as possible. This means that the library will do its best to not throw any exceptions or errors if your SQL queries are invalid. It is up to you to write valid queries, just as you would with SQL strings. It is your database's job to report errors in SQL.

This keeps Atlas's runtime footprint at a minimum, allowing you to focus on writing short, readable queries.

Installation

Install with Composer:

composer require rebelcode/atlas

Quick Start

Create an Atlas instance.

use RebelCode\Atlas\Atlas;

$atlas = new Atlas();

Get a table using the table() method:

$users = $atlas->table('users');

Create queries from tables:

$query = $users->select(/* ... */);
$query = $users->insert(/* ... */);
$query = $users->update(/* ... */);
$query = $users->delete(/* ... */);
$query = $users->create(/* ... */);
$query = $users->drop(/* ... */);

Modify queries, if necessary:

use function RebelCode\Atlas\asc;

$query = $query->where($users->role->eq('admin'))
               ->orderBy(asc($users->name))
               ->limit(20)
               ->offset(10);

Render the query into SQL or execute it:

$sql = $query->render();
$result = $query->exec();

Finally, RTFM! Check out the documentation to learn what more you can with Atlas.

Why "Atlas"?

Atlas is the Greek god that holds up the heavens on his shoulders.

Initially, we picked the codename ironically. The package is intended to be lightweight, though it's unclear at what threshold a package becomes "light" or "heavy". We figured that the heavens must be pretty heavy, even for a god. So we used the codename "Atlas".

We decide to keep the name officially, because it's a good fit. Consider how unwieldy SQL strings can be in code, and how important databases are for our applications. So, you can think of Atlas (this package) as shouldering the burden of carrying our database, keeping SQL strings away from our code in the same way that Atlas (the god) keeps the heavens from falling to Earth.

License

GPL-3.0 © RebelCode

Read the full license here.

统计信息

  • 总下载量: 741
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2022-05-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固