1. Go to this page and download the library: Download codera21/sf 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/ */
codera21 / sf example snippets
namespace WebInterface\Controllers;
use System\MVC\Controller;
class PageController extends Controller
{
public function IndexAction()
{
echo("Hello World");
}
}
public function AddAction($num1, $num2)
{
echo $num1 + $num2;
}
function __construct()
{
$this->databaseConnection = new DatabaseConnection();
$this->databaseConnection->ServerName = 'localhost';
$this->databaseConnection->Username = 'root';
$this->databaseConnection->Password = '';
$this->databaseConnection->DatabaseName = 'products';
}
use System\Repositories\Repo;
class ItemRepo extends Repo
{
private $table = 'items';
private $modelClass = 'WebInterface\\Models\\Items';
public function __construct()
{
parent::__construct($this->table, $this->modelClass);
}
}
public function IndexAction()
{
$itemRepo = new ItemRepo();
$itemData = $itemRepo->GetAll();
$this->load->TwigView('Page/index', ['data' => $itemData]);
}
namespace WebInterface\Controllers;
use Repositories\ItemRepo;
use System\MVC\Controller;
class PageController extends Controller
{
private $itemRepo;
public function __construct()
{
parent::__construct();
$this->itemRepo = new ItemRepo();
}
public function IndexAction()
{
$itemData = $this->itemRepo->GetAll();
$this->load->TwigView('Page/index', ['data' => $itemData]);
}
}
Insert($model, $removeFields = array(), $table = null) // this is protected function
UpdateTable($model, $removeFields, $id = null, $table = null, $updateFrom = null, $updateFromValue = null) // this is also protected
GetCurrentDate()
GetCurrentDateTime()
Delete($id, $idFieldName = null)
GetById($id, $idFieldName = null)
GetAllByViewModelWithOutJoin($viewModelClass, $whereConditions = array())
GetAll()
Check($id)
public function Custom($id)
{
$sql = "select * from items where ID = :ID";
$sqlQuery = $this->dbConnection->prepare($sql);
$sqlQuery->bindParam(':ID', $id);
$sqlQuery->execute();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.