1. Go to this page and download the library: Download vaffel/dao 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/ */
vaffel / dao example snippets
// Set up read only mysql
Vaffel\Dao\DaoFactory::setServiceLayer(
Vaffel\Dao\DaoFactory::SERVICE_MYSQL,
Vaffel\Dao\Models\Dao\MySQL::DB_TYPE_RO,
$roPdo // PDO instance, with read-only access
);
// Set up read+write mysql
Vaffel\Dao\DaoFactory::setServiceLayer(
Vaffel\Dao\DaoFactory::SERVICE_MYSQL,
$rwPdo, // PDO instance, with write access
Vaffel\Dao\Models\Dao\MySQL::DB_TYPE_RW
);
$userDao = DaoFactory::getDao('MyApplication\Models\User');
// Return user with id 1337
$user = $userDao->fetch(1337);
// Set first name on the returned user
$user->setFirstName('Kristoffer');
// Persist the updated user object
$userDao->save($user);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.