Skip to content

Commit 542ff5d

Browse files
committed
feat: add alias to maintain version compat
1 parent e6641b0 commit 542ff5d

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

src/Db/Core.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function __construct(
114114
}
115115

116116
/**
117-
* Load db credentials, but defer connection until needed
117+
* Connect to database immediately
118118
*
119119
* @param string|array $host Host Name or full config
120120
* @param string $dbname Database name
@@ -198,6 +198,27 @@ public function connect(
198198
return $this;
199199
}
200200

201+
/**
202+
* Alias for connect
203+
*
204+
* @param string|array $host Host Name or full config
205+
* @param string $dbname Database name
206+
* @param string $user Database username
207+
* @param string $password Database password
208+
* @param string $dbtype Type of database: mysql, postgres, sqlite, ...
209+
* @param array $pdoOptions Options for PDO connection
210+
*/
211+
public function load(
212+
$host = '127.0.0.1',
213+
string $dbname = '',
214+
string $user = 'root',
215+
string $password = '',
216+
string $dbtype = 'mysql',
217+
array $pdoOptions = []
218+
): Core {
219+
return $this->connect($host, $dbname, $user, $password, $dbtype, $pdoOptions);
220+
}
221+
201222
/**
202223
* Connect to database using environment variables
203224
*

0 commit comments

Comments
 (0)