Usually i call this in a common file like a index or header $psl = new phpSec\Core(); $psl['store'] = $psl->share(function($psl) { $dsn = 'mysql:' . 'dbname=test;' . 'table=phpsec;' . 'host=localhost;' . 'username=databaseusername;' . 'password=databasepassword'; return new phpSec\Store\Pdo($dsn, $psl); }); Definind the $dsn in such a major file seems really unsafe and unconfortable as well. We need something like $dsn = 'mysql:' . 'dbname=test;' . 'table=phpsec;' . 'host=localhost;' . 'username=databaseusername;' . 'password=databasepassword'; $psl = new phpSec\Core(); $psl['store'] = $psl->share(function($dsn, $psl) { return new phpSec\Store\Pdo($dsn, $psl); }); Any ideas?
Usually i call this in a common file like a index or header
$psl = new phpSec\Core();
$psl['store'] = $psl->share(function($psl) {
$dsn = 'mysql:' .
'dbname=test;' .
'table=phpsec;' .
'host=localhost;' .
'username=databaseusername;' .
'password=databasepassword';
return new phpSec\Store\Pdo($dsn, $psl);
});
Definind the $dsn in such a major file seems really unsafe and unconfortable as well.
We need something like
$dsn = 'mysql:' .
'dbname=test;' .
'table=phpsec;' .
'host=localhost;' .
'username=databaseusername;' .
'password=databasepassword';
$psl = new phpSec\Core();
$psl['store'] = $psl->share(function($dsn, $psl) {
return new phpSec\Store\Pdo($dsn, $psl);
});
Any ideas?