codeigniter-cli icon indicating copy to clipboard operation
codeigniter-cli copied to clipboard

Add calling pre_system hook

Open sunadarake opened this issue 2 years ago • 0 comments

Hi. Thanks for the great library!

This PR attempts to add calling pre_system hook in ci_instance.php

In CodeIgniter3, the pre_system hook is called before initializing Controller, but the hook is not called in this tool.

https://github.com/bcit-ci/CodeIgniter/blob/63d037565dd782795021dcbd3b1ca6f8c8a509e4/system/core/CodeIgniter.php#L166-L179

Calling pre_system hook has the advantage that we can use libraries such as phpdotenv to write config files as follows.

# application/config/database.php

$db['default'] = array(
    'dsn'    => '',
    'hostname' => $_ENV["DB_HOST"],
    'username' => $_ENV["DB_USER"],
    'password' => $_ENV["DB_PASS"],
    'database' => $_ENV["DB_NAME"],

Thanks.

sunadarake avatar Jun 02 '23 12:06 sunadarake