Skip to content

avoutic/web-framework-mysql

Repository files navigation

WebFramework MySQL Module

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.

About

MySQL module for web-framework

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages