{"id":22582702,"url":"https://github.com/sunuazizrahayu/phpdotenv-for-codeigniter","last_synced_at":"2025-04-10T19:25:38.918Z","repository":{"id":164631545,"uuid":"184839077","full_name":"sunuazizrahayu/phpdotenv-for-codeigniter","owner":"sunuazizrahayu","description":"Integrating phpdotenv ( .env ) files in CodeIgniter 3","archived":false,"fork":false,"pushed_at":"2024-08-19T11:29:18.000Z","size":68,"stargazers_count":8,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T17:02:01.433Z","etag":null,"topics":["codeigniter","codeigniter3","env","phpdotenv"],"latest_commit_sha":null,"homepage":"","language":null,"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/sunuazizrahayu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2019-05-04T01:23:03.000Z","updated_at":"2025-01-05T10:25:59.000Z","dependencies_parsed_at":"2023-08-25T01:02:40.447Z","dependency_job_id":null,"html_url":"https://github.com/sunuazizrahayu/phpdotenv-for-codeigniter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunuazizrahayu%2Fphpdotenv-for-codeigniter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunuazizrahayu%2Fphpdotenv-for-codeigniter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunuazizrahayu%2Fphpdotenv-for-codeigniter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunuazizrahayu%2Fphpdotenv-for-codeigniter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunuazizrahayu","download_url":"https://codeload.github.com/sunuazizrahayu/phpdotenv-for-codeigniter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248281388,"owners_count":21077423,"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":["codeigniter","codeigniter3","env","phpdotenv"],"created_at":"2024-12-08T06:12:07.273Z","updated_at":"2025-04-10T19:25:38.906Z","avatar_url":"https://github.com/sunuazizrahayu.png","language":null,"readme":"# PHP DotEnv for CodeIgniter\n\u003e Autodetect environment type and load variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.\n\n![](cover.png)\n\n\n\n\n\n## Installation\n1. Install Composer\n```\n$ curl -s http://getcomposer.org/installer | php\n```\n\n2. Paste all of these files to your CodeIgniter root.\n3. Install package on `application` directory\n```\n$ cd application\n$ composer install\n```\n\n\n\n\n\n## Configuration\n1. Enable your Composer Autoload and Hooks: `application/config/config.php`\n\n`$config['enable_hooks'] = FALSE;` to `$config['enable_hooks'] = TRUE;`\n\n`$config['composer_autoload'] = FALSE;` to `$config['composer_autoload'] = TRUE;`\n\n\n2. Add this code to your application hooks: `application/config/hooks.php`\n\n```\n// Use this code if your .env files on *CodeIgniter ROOT* folder\n$hook['pre_system'] = function() {\n\t$dotenv = Dotenv\\Dotenv::create(FCPATH);\n\t$dotenv-\u003eload();\n};\n```\n\nor\n```\n// Use this code if your .env files on *application* folder\n$hook['pre_system'] = function() {\n\t$dotenv = Dotenv\\Dotenv::create(APPPATH);\n\t$dotenv-\u003eload();\n};\n```\n\n3. Create your *.env* files\n```\n$ cp .env.example .env\n```\n\n\n\n\n\n## Usage Example\n\n### Database Configuration\n1. Edit `database.php` on `application/config/database.php`\n2. Replace this code:\n```\n\t'hostname' =\u003e 'localhost',\n\t'username' =\u003e '',\n\t'password' =\u003e '',\n\t'database' =\u003e '',\n\t'dbdriver' =\u003e 'mysqli',\n```\n\nto\n```\n\t'hostname' =\u003e getenv('DB_HOSTNAME'),\n\t'username' =\u003e getenv('DB_USERNAME'),\n\t'password' =\u003e getenv('DB_PASSWORD'),\n\t'database' =\u003e getenv('DB_DATABASE'),\n\t'dbdriver' =\u003e getenv('DB_DRIVER'),\n```\n\n\n\n\n\n\n## Contributing\n1. Fork it!\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Make your changes\n4. Commit your changes (`git commit -am 'Add my feature'`)\n5. Push to the branch (`git push origin my-new-feature`)\n6. Create a new Pull Request\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunuazizrahayu%2Fphpdotenv-for-codeigniter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunuazizrahayu%2Fphpdotenv-for-codeigniter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunuazizrahayu%2Fphpdotenv-for-codeigniter/lists"}