<p>This is for my DB class. I am new to OO, been a procedural lad for some time, so I'm still a bit murky.</p>

<p>My first idea was using a bunch of setter functions/methods.. but after writing a whole bunch, I thought about using PHP's define function, like so.</p>

<pre><code>define('MYSQL_USERNAME', 'jimbo');
</code></pre>

<p>Is this an accepted practice? What is the best practice? Should I really clutter my class with a bunch of setter functions (I am currently the only developer using these classes). What are your solutions?</p>

<p>Thank you!</p>

there are probably a few options to deal with this:
just use setters, it's perfectly acceptable, but can get a bit "wordy" with a lot of config options.
use a config object to pass in:
```
```
$config = (object) array(
   'prop1' => 'somevalue',
   'prop2' => 'somevalue2',
   'prop3' => 'somevalue3',
);

$db = new DB($config);
```
```
if you want to use constants, you could restrict them to the class to avoid global namespace pollution:
```
```
class DB {
    const USER = 'mysqluser';
}

echo DB::USER; // for example
```
```