{"id":22814463,"url":"https://github.com/68publishers/environment","last_synced_at":"2026-02-24T03:32:54.193Z","repository":{"id":56217478,"uuid":"261587744","full_name":"68publishers/environment","owner":"68publishers","description":":atom: The component for loading the ENV variables and detecting a debug mode","archived":false,"fork":false,"pushed_at":"2024-08-06T00:54:11.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-28T20:17:44.584Z","etag":null,"topics":["composer-plugin","env","environment","nette"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/68publishers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-05T21:33:03.000Z","updated_at":"2024-08-06T00:20:52.000Z","dependencies_parsed_at":"2024-11-13T15:33:55.431Z","dependency_job_id":null,"html_url":"https://github.com/68publishers/environment","commit_stats":{"total_commits":20,"total_committers":1,"mean_commits":20.0,"dds":0.0,"last_synced_commit":"baa57f05bcd01ea83c3bb9b3dc2d573299715003"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/68publishers/environment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/68publishers%2Fenvironment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/68publishers%2Fenvironment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/68publishers%2Fenvironment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/68publishers%2Fenvironment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/68publishers","download_url":"https://codeload.github.com/68publishers/environment/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/68publishers%2Fenvironment/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29770768,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T03:15:54.600Z","status":"ssl_error","status_checked_at":"2026-02-24T03:15:54.143Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["composer-plugin","env","environment","nette"],"created_at":"2024-12-12T13:09:00.751Z","updated_at":"2026-02-24T03:32:54.171Z","avatar_url":"https://github.com/68publishers.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eEnvironment\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003eThe component based on the \u003ca href=\"https://symfony.com/doc/current/components/dotenv.html\"\u003esymfony/dotenv\u003c/a\u003e for simple loading of the ENV variables and detecting a debug mode.\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/68publishers/environment/actions\"\u003e\u003cimg alt=\"Checks\" src=\"https://badgen.net/github/checks/68publishers/environment/master\"\u003e\u003c/a\u003e\n\u003ca href=\"https://coveralls.io/github/68publishers/environment?branch=master\"\u003e\u003cimg alt=\"Coverage Status\" src=\"https://coveralls.io/repos/github/68publishers/environment/badge.svg?branch=master\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/68publishers/environment\"\u003e\u003cimg alt=\"Total Downloads\" src=\"https://badgen.net/packagist/dt/68publishers/environment\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/68publishers/environment\"\u003e\u003cimg alt=\"Latest Version\" src=\"https://badgen.net/packagist/v/68publishers/environment\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/68publishers/environment\"\u003e\u003cimg alt=\"PHP Version\" src=\"https://badgen.net/packagist/php/68publishers/environment\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Installation\n\n```sh\n$ composer require 68publishers/environment\n```\n\n## Usage\n\n### Default ENV variables\n\nThe default ENV variables are:\n\n- APP_ENV\n- APP_DEBUG \n\nBoth variables will be always accessible in the global arrays `$_ENV` and `$_SERVER`. \nThe default value for `APP_ENV` is `dev` and `0` for `APP_DEBUG`.\n\n### ENV variables loading  \n\nFor ENV variables loading call this static method after requiring Composer's autoload and before your application is stared. \nThe first argument is a relative path to the application root directory and the second argument is an array of debug mode detectors.\n\n```php\n\u003c?php\n\nuse SixtyEightPublishers\\Environment\\Debug;\nuse SixtyEightPublishers\\Environment\\Bootstrap\\EnvBootstrap;\n\nrequire __DIR__ . '/../vendor/autoload.php';\n\nEnvBootstrap::boot([\n    new Debug\\CliOptionDetector('debug_please'), // the debug mode is enabled if an option \"--debug_please\" is defined (CLI only)\n    new Debug\\IpAddressDetector([\n        '185.141.252.240', // the debug mode is enabled always for this IP address\n        'john_dee@135.151.252.240', // the debug mode is enabled for this IP address and a cookie called \"debug_please\" must exist with value \"john_dee\"\n    ], 'debug_please'),\n    new Debug\\SimpleCookieDetector('ineeddebug123', 'debug_please'), // the debug mode is enabled if a cookie called \"debug_please\" exists and has the value \"ineeddebug123\"\n    new Debug\\EnvDetector(), // the detection is performed from loaded ENV variables, the debug mode is enabled if a variable \"APP_DEBUG=1\" is defined or if a variable \"APP_ENV\" has a different value than, \"prod\"\n]);\n\n// All your ENV variables are now accessible in the global arrays `$_ENV` and `$_SERVER`\n```\n\nIf you're using [Nette Framework](https://nette.org) then you can use this method in the application bootstrap instead:\n\n```php\n\u003c?php\n\nuse Nette\\Bootstrap\\Configurator;\nuse SixtyEightPublishers\\Environment\\Bootstrap\\EnvBootstrap;\n\nrequire __DIR__ . '/../vendor/autoload.php';\n\n$configurator = new Configurator();\n\nEnvBootstrap::bootNetteConfigurator($configurator, [\n\t// define detectors here\n]);\n\n// All your ENV variables are now accessible in the global arrays `$_ENV` and `$_SERVER`\n// The debug mode on the configurator is set by the ENV variable `APP_DEBUG`\n// The ENV variables are accessible in DI container and Neon configuration as dynamic parameters with prefix `env.` e.g. `%env.APP_ENV%`\n```\n\n### ENV variables caching/dumping\n\nAll ENV variables are always (in each request) parsed from `.env` files by default. \nThis is a good solution for developers because all changes are immediately applied after the change.\nBut sometimes (mainly on the production) you don't want to parse `.env` files in each request. If you want to cache the ENV variables then run following Composer command:\n\n```bash\n$ composer dotenv:dump \u003cAPP_ENV\u003e\n\nor shorter\n\n$ composer dump-env \u003cAPP_ENV\u003e\n```\n\nThe file `.env.local.php` will be created in the application's root directory, and it will be used instead of all your `.env` files.\n\n### Nette DI Extension\n\nThe package includes the Compiler Extension to Nette DI. Its registration is not necessary for variables loading to work, but it adds two console commands to the application.\n\n```neon\nextensions:\n\tenvironment: SixtyEightPublishers\\Environment\\Bridge\\Nette\\DI\\EnvironmentExtension\n```\n\n#### Command `dotenv:dump`\n\nThe command works just like the composer command. The `env` argument is optional here, the current `APP_ENV` of the application is used as the default value.\n\n```sh\n$ bin/console dotenv:dump [\u003cenv\u003e] [--empty]\n```\n\n#### Command `debug:dotenv`\n\nThe command lists all dotenv files with variables and values.\n\n```sh\n$ bin/console debug:dotenv\n```\n\n## Contributing\n\nBefore opening a pull request, please check your changes using the following commands\n\n```bash\n$ make init # to pull and start all docker images\n\n$ make cs.check\n$ make stan\n$ make tests.all\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F68publishers%2Fenvironment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F68publishers%2Fenvironment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F68publishers%2Fenvironment/lists"}