承接 ghostwriter/environment 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ghostwriter/environment

最新稳定版本:2.0.0

Composer 安装命令:

composer require ghostwriter/environment

包简介

Provides Environment Variables derived from `$_ENV` and `$_SERVER` super-globals

README 文档

README

GitHub Sponsors Automation Supported PHP Version Downloads

Provides Environment Variables derived from $_ENV and $_SERVER super-globals

Installation

You can install the package via composer:

composer require ghostwriter/environment

Usage

$environment = new \Ghostwriter\Environment\Environment();

$environment->has('APP_ENV'); // false
$environment->get('APP_ENV', 'dev'); // dev
$environment->get('APP_ENV'); // throws NotFoundException
$environment->set('APP_ENV', 'production');
$environment->has('APP_ENV'); // true
$environment->get('APP_ENV'); // production
$environment->unset('APP_ENV');

$environment->set('APP_KEY', 'secrete');
$environment->has('APP_KEY'); // true
$environment->get('APP_KEY'); // secrete
$environment->unset('APP_KEY');
$environment->has('APP_KEY'); // false
$environment->get('APP_KEY', 'fallback-value'); // fallback-value
$environment->get('APP_KEY'); // throws NotFoundException

API

interface Variables extends Countable, IteratorAggregate
{
    public function count(): int;
    public function get(string $name, string|null $default = null): string;
    /**
     * @return Generator<non-empty-string,non-empty-string>
     */
    public function getIterator(): Generator;
    public function has(string $name): bool;
    public function set(string $name, string $value): void;
    /**
     * @return non-empty-array<non-empty-string,non-empty-string>
     */
    public function toArray(): array;
    public function unset(string $name): void;
}

Testing

composer test

Changelog

Please see CHANGELOG.md for more information what has changed recently.

Security

If you discover any security related issues, please email nathanael.esayeas@protonmail.com instead of using the issue tracker.

Sponsors

[Become a GitHub Sponsor]

Credits

License

The BSD-3-Clause. Please see License File for more information.

统计信息

  • 总下载量: 322.29k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2022-07-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固