avoutic/web-framework-mysql
最新稳定版本:4.0.0
Composer 安装命令:
composer require avoutic/web-framework-mysql
包简介
MySQL module for WebFramework
README 文档
README
This module provides MySQL and MariaDB database integration for WebFramework.
Installation
Install via Composer:
composer require avoutic/web-framework-mysql
Make sure the definitions file is included in your project by adding it to definition_files in your config.php file:
return [ 'definition_files' => [ '../vendor/avoutic/web-framework/definitions/definitions.php', '../vendor/avoutic/web-framework-mysql/definitions/definitions.php', 'app_definitions.php', ], ];
Requirements
- PHP 8.2 or higher
- MySQL or MariaDB server
- PHP mysqli extension
- WebFramework core package (^11)
Usage
The module provides MySQL integration for WebFramework, enabling database access. It implements the WebFramework Database interface to access the database.
To use MySQL for database access you need to add it in your PHP-DI definitions:
return [ Database::class => DI\autowire(MysqliDatabase::class), ];
Configuration
If you are using the definition from definitions/defitinions.php. You can just add the following db_config.main.php to your auth config directory (config/auth):
<?php return [ 'database_host' => env('DATABASE_HOST', 'localhost'), 'database_user' => env('DATABASE_USER', 'your_user'), 'database_password' => env('DATABASE_PASSWORD', 'your_password'), 'database_database' => env('DATABASE_DATABASE', 'your_database') ]
License
MIT License - see LICENSE file for details.
统计信息
- 总下载量: 1.17k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-29