1. Go to this page and download the library: Download piano/mvc 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/ */
namespace app\modules\application\controllers;
class IndexController extends Piano\Mvc\Controller
{
protected function initialize()
{
// Do some action before executing any other code of your controller.
}
}
$pdo = new PDO("mysql:host=host;dbname=db;", 'user', 'pass');
$userDAO = new \app\dataAccess\UserDataAccess($pdo);
$status = $userDAO->delete(
'id = :id',
array(
array(':id', 2, PDO::PARAM_INT),
)
);
// or
$userDAO = new \app\dataAccess\UserDataAccess($pdo);
$status = $userDAO->delete('id = 2');
$pdo = new PDO("mysql:host=host;dbname=db;", 'user', 'pass');
$userDAO = new \app\dataAccess\UserDataAccess($pdo);
$users = $userDAO->getAll(
array(
'columns' => '*',
'condition' => 'id = :id',
'values' => array(
array(':id', 1, PDO::PARAM_INT),
)
),
'id DESC',
10, // show 10 records
30 // start showing from the 30th record
);
// or
$userDAO = new \app\dataAccess\UserDataAccess($pdo);
$users = $userDAO->getAll();
$pdo = new PDO("mysql:host=host;dbname=db;", 'user', 'pass');
$userDAO = new \app\dataAccess\UserDataAccess($pdo);
$user = $userDAO->getFirst(
array(
'columns' => '*',
'condition' => 'id = :id',
'values' => array(
array(':id', 1, PDO::PARAM_INT)
)
)
);
// or
$userDAO = new \app\dataAccess\UserDataAccess($pdo);
$user = $userDAO->getFirst();
$this->getApplication()->getModuleName();
$this->getApplication()->getControllerName();
$this->getApplication()->getActionName();
$config = new Piano\Config\Ini('/path/to/config.ini');
$configIni = $config->get();
// getting a simple value
$configIni = $config->get('name');
// If "name" doesn't exist in config file, it will return an empty array.
// getting a section
$configIni = $config->get('section_name');
// If section_name doesn't exist in config file, it will return an empty array.
// The config array must be like this.
$config = [
'dbAdapter' => 'mysql',
'dbHost' => 'localhost',
'dbName' => '',
'dbUser' => '',
'dbPass' => '',
];
$pdo = new Piano\Config\Pdo($config);
$pdo = $pdo->get();
// It'll return all your routes definitions.
$router->getRoutes();
// It'll return informations from the given route, in this case `myRouteName`
$router->getRoutes('myRouteName');
<a href=" echo $this->url('route_name');
<form action=" echo $this->url('contact');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.