This module provides MySQL and MariaDB database integration for WebFramework.
Install via Composer:
composer require avoutic/web-framework-mysqlMake 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',
],
];- PHP 8.2 or higher
- MySQL or MariaDB server
- PHP mysqli extension
- WebFramework core package (^11)
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),
];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')
]MIT License - see LICENSE file for details.