承接 tangwei/hyperf-oracle 相关项目开发

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

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

tangwei/hyperf-oracle

最新稳定版本:v3.1.2

Composer 安装命令:

composer require tangwei/hyperf-oracle

包简介

A oracle handler for hyperf/database.

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

Hyperf-Oracle

Hyperf-Oracle is an Oracle Database Driver package for Hyperf. Extension of Hyperf\Database that uses pdo-oci extension to communicate with Oracle. Through integration of Swoole, Hyperf optimizes resource utilization and boosts concurrency, leading to enhanced throughput and responsiveness when interfacing with Oracle databases.

Quick Installation

composer require tangwei/hyperf-oracle

Example

use Hyperf\DbConnection\Db;

// select
Db::table('users')->get();
// insert
Db::table('users')->insert(['name' => 'jonas']);
// update
Db::table('users')->where('id', '=', 1)->update(['name' => 'johnny']);
// delete
Db::table('users')->delete(1);

Environment Settings

The following environment variables should be configured to specify the connection details for the Oracle database:

DB_DRIVER=oracle
DB_HOST=oracle.host
DB_PORT=1521
DB_SERVICE_NAME=XE
DB_SID=XE
DB_USERNAME=user
DB_PASSWORD=password
DB_CHARSET=utf8mb4
DB_AUTO_COMMIT=false
DB_TIMEZONE=America/Sao_Paulo

Configuration in Code

In your databases.php configuration file, you can set up the database connection using the following format:

return [
    'default' => [
        'driver' => env('DB_DRIVER', 'oracle'),
        'host' => env('DB_HOST', 'host'),
        'port' => env('DB_PORT', 1521),
        'database' => env('DB_DATABASE', 'hyperf'),
        'username' => env('DB_USERNAME', 'oracle'),
        'service_name' => env('DB_SERVICE_NAME', 'XE'),
        'sid' => env('DB_SID', 'XE'),
        'auto_commit' => env('DB_AUTO_COMMIT', false),
        'timezone' => env('DB_TIMEZONE', 'America/Sao_Paulo'),
        'password' => env('DB_PASSWORD', 'password'),
        'charset' => env('DB_CHARSET', 'AL32UTF8'),
        'prefix' => env('DB_PREFIX', ''),
        'pool' => [
            'min_connections' => 1,
            'max_connections' => 10,
            'connect_timeout' => 10.0,
            'wait_timeout' => 3.0,
            'heartbeat' => -1,
            'max_idle_time' => (float) env('DB_MAX_IDLE_TIME', 60),
        ],
        'commands' => [
            'gen:model' => [
                'path' => 'app/Model',
                'force_casts' => true,
                'inheritance' => 'Model',
                'uses' => '',
                'table_mapping' => [],
            ],
        ],
    ],
];

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-24