Download the PHP package yangweijie/think-orm-async without Composer

On this page you can find all versions of the php package yangweijie/think-orm-async. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package think-orm-async

ThinkOrmAsync - think-orm 异步批量查询扩展

功能特性

安装

快速开始

1. 在模型中引入 trait

2. 使用异步查询

基本使用

ORM 查询

原生 SQL 查询

混合使用 ORM 和原生查询

配置

自动配置(推荐)

在 ThinkPHP 项目中,AsyncContext::start() 会自动从 config('database.connections.mysql') 读取配置:

手动配置

在非 ThinkPHP 项目中,需要手动传递配置:

设置超时

重试机制

仅重试连接错误,不重试 SQL 逻辑错误。

可重试错误

不重试错误

重试策略

错误处理

处理查询失败

处理部分失败

高级用法

数组访问和遍历

转换为数组和 JSON

获取模型对象

辅助方法

注意事项

  1. ThinkPHP 环境:在 ThinkPHP 项目中,会自动从 config('database.connections.mysql') 读取配置
  2. mysqlnd 驱动:需要使用 mysqlnd 驱动(PHP 5.3+ 默认)
  3. 不要在循环中使用:避免在循环中嵌套 AsyncContext::start() / AsyncContext::end()
  4. 错误处理:查询失败时会抛出异常,需要自行处理
  5. 表前缀:确保模型类正确设置了 $name$prefix 属性

性能提升

在多个独立查询的场景下,异步查询可以显著减少网络往返延迟:

查询数 同步查询 异步查询 提升
3 300ms 150ms 50%
5 500ms 200ms 60%
10 1000ms 350ms 65%

假设:每个查询平均耗时 100ms,网络往返 50ms

测试

测试使用 Pest 框架,使用 Mock 对象,无需真实数据库连接。

许可证

MIT


All versions of think-orm-async with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package yangweijie/think-orm-async contains the following files

Loading the files please wait ...