dev-master
9999999-devWeb Skeleton Application for bootphp
MIT
The Requires
- php >=5.5.0
The Development Requires
0.0.0
0.0.0.0Web Skeleton Application for bootphp
MIT
The Requires
- php >=5.5.0
The Development Requires
Web Skeleton Application for bootphp
Simple and Light weight MVC framework in PHP, it serves all stable functionalties like routing (native), caching (phpFastCache), database (Redbeans & PDO), templating (Smarty), authentication (Basic,SSO & Custom), Session/Roles etc., (*1)
$ composer create-project bootphp/project my_project $ cd my_project $ composer update $ composer require bootphp/rudrax
http://local.piggy.com?RX_MODE_DEBUG=true&RX_MODE_BUILD=1&_display_errors_=2
http://local.piggy.com/welcome?name=Lucas http://local.piggy.com/api/data/7 http://local.piggy.com
If you have used create-project command then this directory structure will be automatically created for you. Otherwise create it manually. and make sure build folder has correct permisson 0777, (*2)
-app L controller // Controller/URL Mapping for Project, name of file and class should match L model //Models being Used in Porject L view //Smart Templates -config L project.properties //Project Properties -build // Build/Temporary Files created by Framwork, need write permissions -src // Folder for static files like javascript,html,css -lib // composer library folder -index.php .htaccess -composer.json // set config->vendor-dir = lib
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"); } } } }
All are method level annotations
- @RequestMapping - URL info
- url - url pattern to match
- method - request method [GET|POST|PUT|DELETE] - used only if mentioned
- type - response type [template|json|data] - data
- auth - if url acccess requires basic auth [TRUE|FALSE] - FALSE
- cache - if response is cacheable by server [TRUE|FALSE] - FALSE
- guestcache - cacheable only if guest user (user not valid) [TRUE|FALSE] - FALSE
- @RequestParams - if query params to be fetched and used in controller. [TRUE|FALSE] - FALSE
- @Role - [user defined values] - used only if mentioned, users with matching $user->{role} will have access to api., (*3)
Class Level Annotations - @Model - [sessionUser] - - sessionUser - if used then that model will be used as default Session user, Class must extend app\model\AbstractUser, (*4)
To build project/clear cache/rebuild annotations - Hit this URL from Browser, (*5)
http://localhost/?RX_MODE_BUILD=TRUE&RX_MODE_DEBUG=TRUE
Web Skeleton Application for bootphp
MIT
Web Skeleton Application for bootphp
MIT