{"id":14987257,"url":"https://github.com/agungjk/phpdotenv-for-codeigniter","last_synced_at":"2025-04-11T23:23:29.100Z","repository":{"id":62889852,"uuid":"44518265","full_name":"agungjk/phpdotenv-for-codeigniter","owner":"agungjk","description":"Loads environment variables from `.env` to `getenv()` automagically.","archived":false,"fork":false,"pushed_at":"2018-05-08T05:01:18.000Z","size":66,"stargazers_count":103,"open_issues_count":4,"forks_count":46,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-03T19:43:19.242Z","etag":null,"topics":["codeigniter","environment","htaccess-files","nginx","php"],"latest_commit_sha":null,"homepage":null,"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/agungjk.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}},"created_at":"2015-10-19T07:31:50.000Z","updated_at":"2024-09-06T15:22:17.000Z","dependencies_parsed_at":"2022-11-08T15:00:20.585Z","dependency_job_id":null,"html_url":"https://github.com/agungjk/phpdotenv-for-codeigniter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agungjk%2Fphpdotenv-for-codeigniter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agungjk%2Fphpdotenv-for-codeigniter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agungjk%2Fphpdotenv-for-codeigniter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agungjk%2Fphpdotenv-for-codeigniter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agungjk","download_url":"https://codeload.github.com/agungjk/phpdotenv-for-codeigniter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248493542,"owners_count":21113277,"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","environment","htaccess-files","nginx","php"],"created_at":"2024-09-24T14:14:20.460Z","updated_at":"2025-04-11T23:23:29.082Z","avatar_url":"https://github.com/agungjk.png","language":"PHP","readme":"# PHP dotenv for codeigniter\n\u003e Autodetect environment type and load variables from `.env` to `getenv()` automagically.\n\nThis is a PHP version of the original [Ruby dotenv](https://github.com/bkeepers/dotenv).\n\n![](cover.png)\n\n## Manual Installation without Composer\n1. Copy folder **system** to your codeigniter projects.\n2. Add this code to your codeigniter index.php before codeigniter core loaded (before this text \"* LOAD THE BOOTSTRAP FILE\") :\n    ```php\n\t\t/*\n\t\t * --------------------------------------------------------------------\n\t\t * LOAD PHP DOT ENV FILE\n\t\t * --------------------------------------------------------------------\n\t\t *\n\t\t * And away we go...\n\t\t *\n\t\t */\n\t\trequire_once BASEPATH . 'dotenv/autoloader.php';\n\t\t\n\t\t$dotenv = new Dotenv\\Dotenv(__DIR__);\n\t\t$dotenv-\u003eload();\n    ```\n\n## Configuration\n1. Create **.env** according your environment by copy file **.env.example** for database configuration and the other configuration. \nExample : **.env.development**, **.env.testing**, **.env.production**\n\n2. Load configuration, in file **application/config/database.php** change to this configuration\n```php\n\t$db['default']['hostname'] = getenv('DB_HOST');\n\t$db['default']['username'] = getenv('DB_USERNAME');\n\t$db['default']['password'] = getenv('DB_PASSWORD');\n\t$db['default']['database'] = getenv('DB_DATABASE');\n\t$db['default']['dbdriver'] = getenv('DB_CONNECTION');\n```\n3. Add \".env\" to your .gitignore file\n4. It will be running, thank you\n\n## Release History\n\n* 0.1.1\n    * CHANGE: Autodetect environment \u0026 Update Readme\n* 0.1.0\n    * Initial version\n\n## Meta\n\nAgung Jati Kusumo – [@its_agungjk](https://twitter.com/its_agungjk) – agungjk.social@gmail.com\n\nDistributed under the MIT license. See ``LICENSE`` for more information.\n\n[https://github.com/agungjk/phpdotenv-for-codeigniter](https://github.com/agungjk/phpdotenv-for-codeigniter)\n\n## Contributing\n\n1. Fork it (\u003chttps://github.com/agungjk/phpdotenv-for-codeigniter/fork\u003e)\n2. Create your feature branch (`git checkout -b feature/fooBar`)\n3. Commit your changes (`git commit -am 'Add some fooBar'`)\n4. Push to the branch (`git push origin feature/fooBar`)\n5. Create a new Pull Request","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagungjk%2Fphpdotenv-for-codeigniter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagungjk%2Fphpdotenv-for-codeigniter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagungjk%2Fphpdotenv-for-codeigniter/lists"}