Use one file to contain configuration variables and exclude this file when sharing code.
For instance:
require_once('config.php'); $this->conn = new mysqli($config['db']['host'], $config['db']['user'], $config['db']['pass'], $config['db']['dbname']);
The config.php will include:
$config['db']['username'] = 'user'; $config['db']['password'] = 'pass'; ...
You can / should extend this to include hostname, port, database, etc.
source share