PHP Classes

File: src/helpers.php

Recommend this page to a friend!
  Classes of Mateo   PHP Telegram Bot to Purge Messages   src/helpers.php   Download  
File: src/helpers.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: PHP Telegram Bot to Purge Messages
Bot to delete messages in telegram
Author: By
Last change:
Date: 1 month ago
Size: 312 bytes
 

Contents

Class file image Download
<?php

/**
 * Get an env variable.
 */
function env(string $key, $default = null): ?string
{
    return
allEnv()[$key] ?? $default;
}

/**
 * Get all env variables.
 * @return array<string, string>
 */
function allEnv(): array
{
    static
$env = null;

   
$env ??= [...getenv(), ...$_ENV];

    return
$env;
}