mirror of
https://codeberg.org/vlw/scaffold.git
synced 2026-04-13 12:59:39 +02:00
Compare commits
No commits in common. "f4b8f8673e7696de3bfdf7a02064c2b94498e385" and "723b048c8f1ac25ef634119ba66927c723c0ebfa" have entirely different histories.
f4b8f8673e
...
723b048c8f
3 changed files with 2 additions and 33 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
# Scaffold
|
# Scaffold
|
||||||
This composer package (primarily) contains my project boilerplate code for working with [Vegvisir](https://vegvisir.vlw.se) and [Reflect](https://reflect.vlw.se) projects. It contains my most commonly used classes and functions which I use to make development of new project in these frameworks easier.
|
This composer package contains my project boilerplate code for working with [Vegvisir](https://vegvisir.vlw.se) and [Reflect](https://reflect.vlw.se) projects. It contains my most commonly used classes and functions which I use to make development of new project in these frameworks easier.
|
||||||
|
|
||||||
Refer to the documentation in each source file for more information about its function.
|
Refer to the documentation in each source file for more information about its function.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "vlw/scaffold",
|
"name": "vlw/scaffold",
|
||||||
"description": "Project scaffolding (primarily) for Reflect and Vegvisir projects",
|
"description": "Project scaffolding for Reflect and Vegvisir projects",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"authors": [
|
"authors": [
|
||||||
|
|
|
||||||
|
|
@ -15,37 +15,6 @@
|
||||||
public const DATE_FORMAT = "Y-m-d";
|
public const DATE_FORMAT = "Y-m-d";
|
||||||
public const DATETIME_FORMAT = "Y-m-d H:i:s";
|
public const DATETIME_FORMAT = "Y-m-d H:i:s";
|
||||||
|
|
||||||
private const DEFAULT_HOSTNAME = "localhost";
|
|
||||||
private const DEFAULT_USERNAME = "www-data";
|
|
||||||
private const DEFAULT_PASSWORD = "";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new Database instance from credentials
|
|
||||||
*
|
|
||||||
* @param string $host
|
|
||||||
* @param string $username
|
|
||||||
* @param string $password
|
|
||||||
* @param string $database
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function set_credentials(
|
|
||||||
?string $host = self::DEFAULT_HOSTNAME,
|
|
||||||
?string $username = self::DEFAULT_USERNAME,
|
|
||||||
?string $password = self::DEFAULT_PASSWORD,
|
|
||||||
string $database
|
|
||||||
) {
|
|
||||||
// Create key if it does not exist
|
|
||||||
if (!$_ENV["mariadb"]) {
|
|
||||||
$_ENV["mariadb"] = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set environment variables from credentials
|
|
||||||
$_ENV["mariadb"]["host"] = $host;
|
|
||||||
$_ENV["mariadb"]["user"] = $username;
|
|
||||||
$_ENV["mariadb"]["pass"] = $password;
|
|
||||||
$_ENV["mariadb"]["db"] = $database;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrap a new vlw/MySQL instance with credentials from project .env.ini
|
* Wrap a new vlw/MySQL instance with credentials from project .env.ini
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue