NETTİM
← Kod Sonuçlarına Dön
PHP MySQL Sınıflar Fonksiyonlar Ağ işlemleri Lisans: MIT

PHP — DbCall.php

PHP MySQL entegrasyonlu — Sınıflar, Fonksiyonlar, Ağ işlemleri. Sınıflar: DbCall. Fonksiyonlar: __construct, setUp, getDriver.
src/Config/Call/DbCall.php • PHP
<?php

declare(strict_types=1);

namespace Flytachi\Winter\Cdo\Config\Call;

use Flytachi\Winter\Cdo\Config\Common\BaseDbConfig;

/**
 * DbCall — Inline Generic Database Configuration
 *
 * A concrete, driver-agnostic config that accepts all connection parameters
 * directly in the constructor.  Use this when you need a one-off connection
 * without defining a dedicated config class.
 *
 * ```
 * $config = new DbCall(
 *     driver:   'mysql',
 *     host:     '127.0.0.1',
 *     port:     3306,
 *     database: 'myapp',
 *     username: 'root',
 *     password: 'secret',
 * );
 *
 * $cdo = $config->connection();
 * ```
 *
 * @package Flytachi\Winter\Cdo\Config\Call
 * @author  Flytachi
 *
 * @link https://winterframe.net/packages/cdo/configuration Inline config — credentials without a class
 */
final class DbCall extends BaseDbConfig
{
    /**
     * @param string $driver   PDO driver name (e.g. `'mysql'`, `'pgsql'`, `'oci'`).
     * @param string $host     Database host.
     * @param int    $port     Database port.
     * @param string $database Database name.
     * @param string $username Authentication username.
     * @param string $password Authentication password.
     */
    public function __construct(
        public string $driver,
        public string $host,
        public int $port,
        public string $database,
        public string $username,
        public string $password,
    ) {
        parent::__construct();
    }

    final public function setUp(): void
    {
    }

    final public function getDriver(): string
    {
        return $this->driver;
    }
}

Benzer Kod Örnekleri

PHP: Constants - Manual
PHP • Sınıflar
PHP — InterviewController.php
PHP • Sınıflar
PHP — APCu.php
PHP • Sınıflar
PHP (Laravel) — 0001_01_01_000000_create_users_table.php
PHP • Laravel • Sınıflar