{"id":15525367,"url":"https://github.com/ghostwriter/environment","last_synced_at":"2025-04-23T08:51:50.479Z","repository":{"id":44088324,"uuid":"511225119","full_name":"ghostwriter/environment","owner":"ghostwriter","description":"Provides Environment Variables derived from `$_ENV` and `$_SERVER` super-globals","archived":false,"fork":false,"pushed_at":"2025-04-22T00:41:59.000Z","size":847,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"2.0.x","last_synced_at":"2025-04-22T01:28:40.382Z","etag":null,"topics":["environment","environment-variables","ghostwriter","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ghostwriter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["ghostwriter"]}},"created_at":"2022-07-06T17:05:34.000Z","updated_at":"2025-04-22T00:42:02.000Z","dependencies_parsed_at":"2023-11-22T20:38:53.410Z","dependency_job_id":"9983f3aa-4f88-44d9-9c3d-d2d9e1cd3e2b","html_url":"https://github.com/ghostwriter/environment","commit_stats":{"total_commits":277,"total_committers":1,"mean_commits":277.0,"dds":0.0,"last_synced_commit":"97d4c52c73c42bd18da241490cd8c296f5b0c6d3"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":"ghostwriter/wip","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghostwriter%2Fenvironment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghostwriter%2Fenvironment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghostwriter%2Fenvironment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghostwriter%2Fenvironment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ghostwriter","download_url":"https://codeload.github.com/ghostwriter/environment/tar.gz/refs/heads/2.0.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250403225,"owners_count":21424773,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["environment","environment-variables","ghostwriter","php"],"created_at":"2024-10-02T10:57:06.042Z","updated_at":"2025-04-23T08:51:50.473Z","avatar_url":"https://github.com/ghostwriter.png","language":"PHP","funding_links":["https://github.com/sponsors/ghostwriter"],"categories":[],"sub_categories":[],"readme":"# Environment\n\n[![GitHub Sponsors](https://img.shields.io/github/sponsors/ghostwriter?label=Sponsor+@ghostwriter/environment\u0026logo=GitHub+Sponsors)](https://github.com/sponsors/ghostwriter)\n[![Automation](https://github.com/ghostwriter/environment/actions/workflows/automation.yml/badge.svg)](https://github.com/ghostwriter/environment/actions/workflows/automation.yml)\n[![Supported PHP Version](https://badgen.net/packagist/php/ghostwriter/environment?color=8892bf)](https://www.php.net/supported-versions)\n[![Downloads](https://badgen.net/packagist/dt/ghostwriter/environment?color=blue)](https://packagist.org/packages/ghostwriter/environment)\n\nProvides Environment Variables derived from `$_ENV` and `$_SERVER` super-globals\n\n## Installation\n\nYou can install the package via composer:\n\n``` bash\ncomposer require ghostwriter/environment\n```\n\n## Usage\n\n```php\n$environment = new \\Ghostwriter\\Environment\\Environment();\n\n$environment-\u003ehas('APP_ENV'); // false\n$environment-\u003eget('APP_ENV', 'dev'); // dev\n$environment-\u003eget('APP_ENV'); // throws NotFoundException\n$environment-\u003eset('APP_ENV', 'production');\n$environment-\u003ehas('APP_ENV'); // true\n$environment-\u003eget('APP_ENV'); // production\n$environment-\u003eunset('APP_ENV');\n\n$environment-\u003eset('APP_KEY', 'secrete');\n$environment-\u003ehas('APP_KEY'); // true\n$environment-\u003eget('APP_KEY'); // secrete\n$environment-\u003eunset('APP_KEY');\n$environment-\u003ehas('APP_KEY'); // false\n$environment-\u003eget('APP_KEY', 'fallback-value'); // fallback-value\n$environment-\u003eget('APP_KEY'); // throws NotFoundException\n```\n\n## API\n\n```php\ninterface Variables extends Countable, IteratorAggregate\n{\n    public function count(): int;\n    public function get(string $name, string|null $default = null): string;\n    /**\n     * @return Generator\u003cnon-empty-string,non-empty-string\u003e\n     */\n    public function getIterator(): Generator;\n    public function has(string $name): bool;\n    public function set(string $name, string $value): void;\n    /**\n     * @return non-empty-array\u003cnon-empty-string,non-empty-string\u003e\n     */\n    public function toArray(): array;\n    public function unset(string $name): void;\n}\n```\n\n## Testing\n\n``` bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG.md](./CHANGELOG.md) for more information what has changed recently.\n\n## Security\n\nIf you discover any security related issues, please email `nathanael.esayeas@protonmail.com` instead of using the issue tracker.\n\n## Sponsors\n\n[[`Become a GitHub Sponsor`](https://github.com/sponsors/ghostwriter)]\n\n## Credits\n\n- [Nathanael Esayeas](https://github.com/ghostwriter)\n- [All Contributors](https://github.com/ghostwriter/environment/contributors)\n\n## License\n\nThe BSD-4-Clause. Please see [License File](./LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghostwriter%2Fenvironment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghostwriter%2Fenvironment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghostwriter%2Fenvironment/lists"}