1. Go to this page and download the library: Download bootphp/project 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/ */
bootphp / project example snippets
namespace app\controller {
class MyController extends AbstractController
{
/**
* @RequestMapping(url="login",method="GET",type="template")
* @RequestParams(true)
*/
public function login($model,$username,$password)
{
if($username == "user1" && $password == "xDddfdfd"){
$this->user->setValid(TRUE);
$this->user->role = "USER";
$model->assign("username", $username);
return "welcome"; // 'welcome' is path of smarty tempalte file in view folder
} else {
$this->user->setValid(FALSE);
$model->assign("error", "Wrong credentials");
return "login"; // 'login' is path of smarty tempalte file in view folder
}
}
/**
* @RequestMapping(url="myprofile",method="GET",type="template")
* @RequestParams(true)
*/
public function myprofile($model)
{
if($this->user->isValid()){
$model->assign("username", $this->user->uname);
return "user/myprofile"; // 'user/myprofile' is path of smarty tempalte file in view folder
} else {
$this->user->setValid(FALSE);
$model->assign("error", "You need to login to view this page");
return "login"; // 'login' is path of smarty tempalte file in view folder
}
}
/**
* @RequestMapping(url="info/school/{category}",method="GET",type="json")
* @RequestParams(true)
*/
public function schoolinfo($category)
{
if($this->user->isValid()){
return array( "success" => true, "id" => 23,"name"=>"DAV Public School");
} else {
return array("success" => false,"error"=> "You need to login to view this info");
}
}
}
}