1. Go to this page and download the library: Download stuartwakefield/platter library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
stuartwakefield / platter example snippets
" "stuartwakefield/platter": "0.1.0"
}
$factory = new Platter(array(
'dbuser' => 'admin',
'dbpassword' => 'password',
'dbname' => 'test',
'dbhost' => '0.0.0.0',
'connectionstring' => function ($container) {
return "mysql:dbname={$container->get('dbname')};host={$container->get('dbhost')}";
},
'pdo' => function ($container) {
return new PDO(
$container->get('connectionstring'),
$container->get('dbuser'),
$container->get('dbpassword')
);
},
'repository' => function ($container) {
return new Repository($container->get('pdo'));
}
));
$repository = $factory->get('repository');
$parent = new Platter(array(
'dbuser' => 'xyz',
'dbpassword' => 'abc'
));
$factory = new Platter(array(
'DataSource' => function ($container) {
return new DataSource(
$container->get('dbuser'),
$container->get('dbpassword')
);
}
), $parent);
$ds = $factory->get('DataSource');
$parent = new Platter(array(
'DataSource' => function ($container) {
return new DataSource(
$container->get('dbuser'),
$container->get('dbpassword')
);
}
));
$factory = new Platter(array(
'dbuser' => 'xyz',
'dbpassword' => 'abc'
), $parent);
$ds = $factory->get('DataSource'); // "Identifier 'dbuser' is not defined"