Browse files

init

  • Loading branch information...
1 parent 2332c3a commit aedc74fddd242bba165a21a73d1c447e2308d118 root committed May 8, 2012
Showing with 12,084 additions and 0 deletions.
  1. +5 −0 .htaccess
  2. +1 −0 app/cache/dummy
  3. +20 −0 app/controllers/ApiController.php
  4. +9 −0 app/controllers/ControllerBase.php
  5. +138 −0 app/controllers/DocumentationController.php
  6. +15 −0 app/controllers/DownloadController.php
  7. +46 −0 app/controllers/IndexController.php
  8. +46 −0 app/controllers/IndexController.php.orig
  9. +9 −0 app/models/Post.php
  10. +17 −0 app/models/Questions.php
  11. +9 −0 app/models/Subscribers.php
  12. +75 −0 app/views/api/class.phtml
  13. +12 −0 app/views/api/index.phtml
  14. +255 −0 app/views/documentation/acl.phtml
  15. +613 −0 app/views/documentation/benchmark.phtml
  16. +113 −0 app/views/documentation/cache.phtml
  17. +127 −0 app/views/documentation/config.phtml
  18. +266 −0 app/views/documentation/controllers.phtml
  19. +609 −0 app/views/documentation/db.phtml
  20. +132 −0 app/views/documentation/filter.phtml
  21. +34 −0 app/views/documentation/index.phtml
  22. +104 −0 app/views/documentation/install.phtml
  23. +129 −0 app/views/documentation/intl.phtml
  24. +42 −0 app/views/documentation/loader.phtml
  25. +134 −0 app/views/documentation/logging.phtml
  26. +111 −0 app/views/documentation/mactools.phtml
  27. +366 −0 app/views/documentation/migrations.phtml
  28. +835 −0 app/views/documentation/models.phtml
  29. BIN app/views/documentation/motivation.phtml
  30. +60 −0 app/views/documentation/mvc.phtml
  31. 0 app/views/documentation/namespaces.phtml
  32. +145 −0 app/views/documentation/pagination.phtml
  33. +87 −0 app/views/documentation/settings.phtml
  34. +384 −0 app/views/documentation/tags.phtml
  35. +237 −0 app/views/documentation/toc.phtml
  36. +399 −0 app/views/documentation/tools.phtml
  37. +447 −0 app/views/documentation/tutorial.phtml
  38. +396 −0 app/views/documentation/views.phtml
  39. +86 −0 app/views/documentation/wamp.phtml
  40. +130 −0 app/views/documentation/wintools.phtml
  41. +95 −0 app/views/documentation/xampp.phtml
  42. +111 −0 app/views/download/index.phtml
  43. +14 −0 app/views/index.phtml
  44. +56 −0 app/views/index/index.phtml
  45. +26 −0 app/views/layouts/api.phtml
  46. +60 −0 app/views/layouts/documentation.phtml
  47. +62 −0 app/views/layouts/main.phtml
  48. +1,066 −0 helpers/hyperlight/hyperlight.php
  49. +84 −0 helpers/hyperlight/languages/cpp.php
  50. +79 −0 helpers/hyperlight/languages/csharp.php
  51. +67 −0 helpers/hyperlight/languages/css.php
  52. +6 −0 helpers/hyperlight/languages/filetypes
  53. +14 −0 helpers/hyperlight/languages/iphp.php
  54. +63 −0 helpers/hyperlight/languages/php.php
  55. +64 −0 helpers/hyperlight/languages/python.php
  56. +107 −0 helpers/hyperlight/languages/vb.php
  57. +54 −0 helpers/hyperlight/languages/xml.php
  58. +169 −0 helpers/hyperlight/preg_helper.php
  59. +1,565 −0 helpers/markdown/markdown.php
  60. +9 −0 index.html
  61. +7 −0 public/.htaccess
  62. +1 −0 public/css/a.css
  63. +98 −0 public/css/api.css
  64. +1 −0 public/css/b.css
  65. +699 −0 public/css/blog.css
  66. +47 −0 public/css/colors/vibrant-ink.css
  67. +71 −0 public/css/colors/zenburn.css
  68. +1 −0 public/css/d.css
  69. +112 −0 public/css/documentation.css
  70. 0 public/css/index.html
  71. +1 −0 public/css/s.css
  72. +623 −0 public/css/style.css
  73. BIN public/favicon.ico
  74. BIN public/files/bench.tar.bz2
  75. 0 public/files/index.html
  76. BIN public/files/phalcon-tools-win.zip
  77. BIN public/files/phalcon-tutorial.zip
  78. BIN public/files/phalcon-win-x64-php5.3-0.2-VC9.zip
  79. BIN public/files/phalcon-win-x64-php5.3-0.3-VC9.zip
  80. BIN public/files/phalcon-win-x86-php5.3-0.2-VC9.zip
  81. BIN public/files/phalcon-win-x86-php5.3-0.3-VC6.zip
  82. BIN public/files/phalcon-win-x86-php5.3-0.3-VC9.zip
  83. BIN public/files/phalcon-win-x86-php5.3.1-0.2-VC9.zip
  84. BIN public/img/08-chat.png
  85. BIN public/img/57-download.png
  86. BIN public/img/96-book.png
  87. BIN public/img/background.png
  88. BIN public/img/bench-1.png
  89. BIN public/img/bench-2.png
  90. BIN public/img/bench-3.png
  91. BIN public/img/book.png
  92. BIN public/img/buttons/aim_16.png
  93. BIN public/img/buttons/aim_32.png
  94. BIN public/img/buttons/apple_16.png
  95. BIN public/img/buttons/apple_32.png
  96. BIN public/img/buttons/bebo_16.png
  97. BIN public/img/buttons/bebo_32.png
  98. BIN public/img/buttons/blogger_16.png
  99. BIN public/img/buttons/blogger_32.png
  100. BIN public/img/buttons/brightkite_16.png
  101. BIN public/img/buttons/brightkite_32.png
  102. BIN public/img/buttons/cargo_16.png
  103. BIN public/img/buttons/cargo_32.png
  104. BIN public/img/buttons/delicious_16.png
  105. BIN public/img/buttons/delicious_32.png
  106. BIN public/img/buttons/designfloat_16.png
  107. BIN public/img/buttons/designfloat_32.png
  108. BIN public/img/buttons/designmoo_16.png
  109. BIN public/img/buttons/designmoo_32.png
  110. BIN public/img/buttons/deviantart_16.png
  111. BIN public/img/buttons/deviantart_32.png
  112. BIN public/img/buttons/digg_16.png
  113. BIN public/img/buttons/digg_32.png
  114. BIN public/img/buttons/digg_alt_16.png
  115. BIN public/img/buttons/dopplr_16.png
  116. BIN public/img/buttons/dopplr_32.png
  117. BIN public/img/buttons/dribbble_16.png
  118. BIN public/img/buttons/dribbble_32.png
  119. BIN public/img/buttons/email_16.png
  120. BIN public/img/buttons/email_32.png
  121. BIN public/img/buttons/ember_16.png
  122. BIN public/img/buttons/ember_32.png
  123. BIN public/img/buttons/evernote_16.png
  124. BIN public/img/buttons/evernote_32.png
  125. BIN public/img/buttons/facebook_16.png
  126. BIN public/img/buttons/facebook_32.png
  127. BIN public/img/buttons/flickr_16.png
  128. BIN public/img/buttons/flickr_32.png
  129. BIN public/img/buttons/forrst_16.png
  130. BIN public/img/buttons/forrst_32.png
  131. BIN public/img/buttons/friendfeed_16.png
  132. BIN public/img/buttons/friendfeed_32.png
  133. BIN public/img/buttons/gamespot_16.png
  134. BIN public/img/buttons/gamespot_32.png
  135. BIN public/img/buttons/google_16.png
  136. BIN public/img/buttons/google_32.png
  137. BIN public/img/buttons/google_plus_16.png
  138. BIN public/img/buttons/google_plus_32.png
  139. BIN public/img/buttons/google_voice_16.png
  140. BIN public/img/buttons/google_voice_32.png
  141. BIN public/img/buttons/google_wave_16.png
  142. BIN public/img/buttons/google_wave_32.png
  143. BIN public/img/buttons/googletalk_16.png
  144. BIN public/img/buttons/googletalk_32.png
  145. BIN public/img/buttons/gowalla_16.png
  146. BIN public/img/buttons/gowalla_32.png
  147. BIN public/img/buttons/grooveshark_16.png
  148. BIN public/img/buttons/grooveshark_32.png
  149. BIN public/img/buttons/ilike_16.png
  150. BIN public/img/buttons/ilike_32.png
  151. BIN public/img/buttons/komodomedia_azure_16.png
  152. BIN public/img/buttons/komodomedia_azure_32.png
  153. BIN public/img/buttons/komodomedia_wood_16.png
  154. BIN public/img/buttons/komodomedia_wood_32.png
  155. BIN public/img/buttons/lastfm_16.png
  156. BIN public/img/buttons/lastfm_32.png
  157. +9 −0 public/img/buttons/license.txt
  158. BIN public/img/buttons/linkedin_16.png
  159. BIN public/img/buttons/linkedin_32.png
  160. BIN public/img/buttons/mixx_16.png
  161. BIN public/img/buttons/mixx_32.png
  162. BIN public/img/buttons/mobileme_16.png
  163. BIN public/img/buttons/mobileme_32.png
  164. BIN public/img/buttons/mynameise_16.png
  165. BIN public/img/buttons/mynameise_32.png
  166. BIN public/img/buttons/myspace_16.png
  167. BIN public/img/buttons/myspace_32.png
  168. BIN public/img/buttons/netvibes_16.png
  169. BIN public/img/buttons/netvibes_32.png
  170. BIN public/img/buttons/newsvine_16.png
  171. BIN public/img/buttons/newsvine_32.png
  172. BIN public/img/buttons/openid_16.png
  173. BIN public/img/buttons/openid_32.png
  174. BIN public/img/buttons/orkut_16.png
  175. BIN public/img/buttons/orkut_32.png
  176. BIN public/img/buttons/pandora_16.png
  177. BIN public/img/buttons/pandora_32.png
  178. BIN public/img/buttons/paypal_16.png
  179. BIN public/img/buttons/paypal_32.png
  180. BIN public/img/buttons/picasa_16.png
  181. BIN public/img/buttons/picasa_32.png
  182. BIN public/img/buttons/pinboard_16.png
  183. BIN public/img/buttons/playstation_16.png
  184. BIN public/img/buttons/playstation_32.png
  185. BIN public/img/buttons/plurk_16.png
  186. BIN public/img/buttons/plurk_32.png
  187. BIN public/img/buttons/posterous_16.png
  188. BIN public/img/buttons/posterous_32.png
  189. BIN public/img/buttons/qik_16.png
  190. BIN public/img/buttons/qik_32.png
  191. BIN public/img/buttons/rdio_16.png
  192. BIN public/img/buttons/rdio_32.png
  193. BIN public/img/buttons/readernaut_16.png
  194. BIN public/img/buttons/readernaut_32.png
  195. BIN public/img/buttons/reddit_16.png
  196. BIN public/img/buttons/reddit_32.png
  197. BIN public/img/buttons/roboto_16.png
  198. BIN public/img/buttons/roboto_32.png
  199. BIN public/img/buttons/rss_16.png
  200. BIN public/img/buttons/rss_32.png
  201. BIN public/img/buttons/sharethis_16.png
  202. BIN public/img/buttons/sharethis_32.png
  203. BIN public/img/buttons/skype_16.png
  204. BIN public/img/buttons/skype_32.png
  205. BIN public/img/buttons/slashdot_16.png
  206. BIN public/img/buttons/slashdot_32.png
  207. BIN public/img/buttons/steam_16.png
  208. BIN public/img/buttons/steam_32.png
  209. BIN public/img/buttons/stumbleupon_16.png
  210. BIN public/img/buttons/stumbleupon_32.png
  211. BIN public/img/buttons/technorati_16.png
  212. BIN public/img/buttons/technorati_32.png
  213. BIN public/img/buttons/tumblr_16.png
  214. BIN public/img/buttons/tumblr_32.png
  215. BIN public/img/buttons/twitter_16.png
  216. BIN public/img/buttons/twitter_32.png
  217. BIN public/img/buttons/viddler_16.png
  218. BIN public/img/buttons/viddler_32.png
  219. BIN public/img/buttons/vimeo_16.png
  220. BIN public/img/buttons/vimeo_32.png
  221. BIN public/img/buttons/virb_16.png
  222. BIN public/img/buttons/virb_32.png
  223. BIN public/img/buttons/windows_16.png
  224. BIN public/img/buttons/windows_32.png
  225. BIN public/img/buttons/wordpress_16.png
  226. BIN public/img/buttons/wordpress_32.png
  227. BIN public/img/buttons/xanga_16.png
  228. BIN public/img/buttons/xanga_32.png
  229. BIN public/img/buttons/xanga_alt_32.png
  230. BIN public/img/buttons/xing_16.png
  231. BIN public/img/buttons/xing_32.png
  232. BIN public/img/buttons/yahoo_16.png
  233. BIN public/img/buttons/yahoo_32.png
  234. BIN public/img/buttons/yahoobuzz_16.png
  235. BIN public/img/buttons/yahoobuzz_32.png
  236. BIN public/img/buttons/yelp_16.png
  237. BIN public/img/buttons/yelp_32.png
  238. BIN public/img/buttons/youtube_16.png
  239. BIN public/img/buttons/youtube_32.png
  240. BIN public/img/buttons/zootool_16.png
  241. BIN public/img/buttons/zootool_32.png
  242. BIN public/img/chat.png
  243. BIN public/img/class.png
  244. BIN public/img/download.png
  245. BIN public/img/exception.png
  246. 0 public/img/index.html
  247. BIN public/img/interface.png
  248. BIN public/img/invo.png
  249. BIN public/img/logo-small.png
  250. BIN public/img/logo.jpg
  251. BIN public/img/logo.png
  252. BIN public/img/mac-1.png
  253. BIN public/img/mac-2.png
  254. BIN public/img/mac-3.png
  255. BIN public/img/mac-4.png
  256. BIN public/img/mac-5.png
  257. BIN public/img/migrations-1.png
  258. BIN public/img/migrations-2.png
  259. BIN public/img/migrations-3.png
  260. BIN public/img/migrations-4.png
  261. BIN public/img/migrations-5.png
  262. BIN public/img/mpm.png
  263. BIN public/img/not.png
  264. BIN public/img/page-background.png
  265. BIN public/img/path-0.png
  266. BIN public/img/path-01.png
  267. BIN public/img/path-1.png
  268. BIN public/img/path-2.png
  269. BIN public/img/path-3.png
  270. BIN public/img/path-4.png
  271. BIN public/img/path-5.png
  272. BIN public/img/path-6.png
  273. BIN public/img/path-7.png
  274. BIN public/img/phalcon.png
  275. BIN public/img/real-falcon.png
  276. BIN public/img/signin_twitter.png
  277. BIN public/img/sprites.png
  278. BIN public/img/sql.png
  279. BIN public/img/tools-1.png
  280. BIN public/img/tools-10.png
  281. BIN public/img/tools-11.png
  282. BIN public/img/tools-12.png
  283. BIN public/img/tools-2.png
  284. BIN public/img/tools-3.png
  285. BIN public/img/tools-4.png
  286. BIN public/img/tools-5.png
  287. BIN public/img/tools-6.png
  288. BIN public/img/tools-7.png
  289. BIN public/img/tools-8.png
  290. BIN public/img/tools-9.png
  291. BIN public/img/tutorial-1.png
  292. BIN public/img/tutorial-2.png
  293. BIN public/img/tutorial-3.png
  294. BIN public/img/tutorial-4.png
  295. BIN public/img/views-1.png
  296. BIN public/img/wamp-1.png
  297. BIN public/img/wamp-2.png
  298. BIN public/img/wamp-3.png
  299. BIN public/img/wamp-4.png
  300. BIN public/img/xampp-1.png
Sorry, we could not display the entire diff because too many files (314) changed.
View
5 .htaccess
@@ -0,0 +1,5 @@
+<IfModule mod_rewrite.c>
+ RewriteEngine on
+ RewriteRule ^$ public/ [L]
+ RewriteRule (.*) public/$1 [L]
+</IfModule>
View
1 app/cache/dummy
@@ -0,0 +1 @@
+-
View
20 app/controllers/ApiController.php
@@ -0,0 +1,20 @@
+<?php
+
+class ApiController extends ControllerBase {
+
+ public function initialize(){
+ $this->view->setTemplateAfter('main');
+ Phalcon_Tag::setTitle('Framework API');
+ parent::initialize();
+ }
+
+ public function indexAction(){
+
+ }
+
+ public function classAction($className){
+ $className = $this->filter->sanitize($className, 'string');
+ $this->view->setParamToView('className', $className);
+ }
+
+}
View
9 app/controllers/ControllerBase.php
@@ -0,0 +1,9 @@
+<?php
+
+class ControllerBase extends Phalcon_Controller {
+
+ public function initialize(){
+ Phalcon_Tag::prependTitle('Phalcon PHP | ');
+ }
+
+}
View
138 app/controllers/DocumentationController.php
@@ -0,0 +1,138 @@
+<?php
+
+require "../helpers/hyperlight/hyperlight.php";
+require "../vendor/tags.php";
+
+class DocumentationController extends ControllerBase {
+
+ public function initialize(){
+ $this->view->setTemplateAfter('main');
+ Phalcon_Tag::setTitle('Documentation');
+ parent::initialize();
+ }
+
+ /*public function beforeDispatch($controllerName, $actionName){
+ $viewPath = '../app/views/documentation/'.$actionName.'.phtml';
+ $cachePath = '../app/cache/docs-'.$actionName;
+ if(filemtime($viewPath)<filemtime($cachePath)){
+ $this->view->setRenderLevel(Phalcon_View::LEVEL_LAYOUT);
+ }
+ }*/
+
+ public function indexAction(){
+
+ }
+
+ public function tocAction(){
+
+ }
+
+ public function motivationAction(){
+
+ }
+
+ public function installAction(){
+
+ }
+
+ public function xamppAction(){
+
+ }
+
+ public function wampAction(){
+
+ }
+
+ public function tutorialAction(){
+
+ }
+
+ public function mvcAction(){
+
+ }
+
+ public function controllersAction(){
+
+ }
+
+ public function modelsAction(){
+
+ }
+
+ public function viewsAction(){
+
+ }
+
+ public function filterAction(){
+
+ }
+
+ public function configAction(){
+
+ }
+
+ public function benchmarkAction(){
+
+ }
+
+ public function paginationAction(){
+
+ }
+
+ public function namespacesAction(){
+
+ }
+
+ public function tagsAction(){
+
+ }
+
+ public function toolsAction(){
+
+ }
+
+ public function wintoolsAction(){
+
+ }
+
+ public function mactoolsAction(){
+
+ }
+
+ public function cacheAction(){
+
+ }
+
+ public function aclAction(){
+
+ }
+
+ public function intlAction(){
+
+ }
+
+ public function dbAction(){
+
+ }
+
+ public function loggingAction(){
+
+ }
+
+ public function loaderAction(){
+
+ }
+
+ public function migrationsAction(){
+
+ }
+
+ public function settingsAction(){
+
+ }
+
+ public function testAction(){
+ //$this->view->setParamToView('errors' , array('value1' => array('value1-1' => 'test'), 'value2' => 'test'));
+ }
+
+}
View
15 app/controllers/DownloadController.php
@@ -0,0 +1,15 @@
+<?php
+
+class DownloadController extends ControllerBase {
+
+ public function initialize(){
+ $this->view->setTemplateAfter('main');
+ Phalcon_Tag::setTitle('Downloads');
+ parent::initialize();
+ }
+
+ public function indexAction(){
+
+ }
+
+}
View
46 app/controllers/IndexController.php
@@ -0,0 +1,46 @@
+<?php
+
+/**
+ * IndexController
+ */
+class IndexController extends ControllerBase {
+
+ public function initialize(){
+ $this->view->setTemplateAfter('main');
+ Phalcon_Tag::setTitle('High performance PHP framework');
+ parent::initialize();
+ }
+
+ public function indexAction(){
+
+ }
+
+ public function subscribeAction(){
+
+ $email = $this->request->getPost('email', 'email');
+ if(!$email){
+ Phalcon_Flash::error('Please provide a valid email');
+ return $this->_forwardToAction('index');
+ }
+
+ $exists = $this->Subscribers->count("email='$email'");
+ if($exists==false){
+ $subscriber = new Subscribers();
+ $subscriber->email = $email;
+ $subscriber->created_at = new Phalcon_Db_RawValue('now()');
+ if($subscriber->save()==false){
+ foreach($subscriber->getMessages() as $message){
+ Phalcon_Flash::error("At this moment you can\'t subscribe");
+ }
+ } else {
+ Phalcon_Flash::success('Thanks for subscribing!');
+ }
+ } else {
+ Phalcon_Flash::success("You are already subscribed!");
+ }
+
+ return $this->_forward('index/index');
+
+ }
+
+}
View
46 app/controllers/IndexController.php.orig
@@ -0,0 +1,46 @@
+<?php
+/**
+* IndexController
+*/
+class IndexController extends Phalcon_Controller {
+
+ public function initialize(){
+ $this->view->setTemplateAfter('main');
+ Phalcon_Tag::setTitle('High performance PHP framework');
+ parent::initialize();
+ }
+
+ public function indexAction(){
+
+ }
+
+ public function subscribeAction(){
+
+ $email = $this->request->getPost('email', 'email');
+ if(!$email){
+ Phalcon_Flash::error('Please provide a valid email');
+ return $this->_forwardToAction('index');
+ }
+
+ $exists = $this->Subscribers->count("email='$email'");
+ if($exists==false){
+ $subscriber = new Subscribers();
+ $subscriber->email = $email;
+ $subscriber->created_at = new Phalcon_Db_RawValue('now()');
+ if($subscriber->save()==false){
+ foreach($subscriber->getMessages() as $message){
+ die(print_r($message,true));
+ Phalcon_Flash::error("At this moment you can\'t subscribe");
+ }
+ } else {
+ Phalcon_Flash::success('Thanks for subscribing!');
+ }
+ } else {
+ Phalcon_Flash::success("You are already subscribed!");
+ }
+
+ return $this->_forwardToAction('index');
+
+ }
+
+}
View
9 app/models/Post.php
@@ -0,0 +1,9 @@
+<?php
+
+class Post extends Phalcon_Model_Base {
+
+ public function initialize(){
+ $this->setSource('post');
+ }
+
+}
View
17 app/models/Questions.php
@@ -0,0 +1,17 @@
+<?php
+
+class Questions extends Phalcon_Model_Base {
+
+ protected $number_views;
+
+ public $number_favorites;
+
+ public function initialize(){
+ $this->setSource('questions');
+ }
+
+ public function getLink(){
+ return 'questions/view/'.$this->id.'/'.str_replace(' ', '-', strtolower($this->subject));
+ }
+
+}
View
9 app/models/Subscribers.php
@@ -0,0 +1,9 @@
+<?php
+
+class Subscribers extends Phalcon_Model_Base {
+
+ public function initialize(){
+ $this->setSource('subscribers');
+ }
+
+}
View
75 app/views/api/class.phtml
@@ -0,0 +1,75 @@
+<?php
+
+require '../refactor.php';
+
+if(isset($refactor[$className])){
+
+ $refactorClass = $refactor[$className];
+
+ echo '<h2>Class <strong>', $className, '</strong></h2>';
+
+ //print_r($refactorClass);
+
+ if($refactorClass['extends']){
+ echo '<h3>Extends</h3>';
+ echo '<span class="icon-class">', Phalcon_Tag::linkTo('api/class/'.$refactorClass['extends'], $refactorClass['extends']), '</span>';
+ }
+
+ if($refactorClass['implements']){
+ echo '<h3>Implements</h3>';
+ echo '<span class="icon-interface">', join(', ', $refactorClass['implements']), '</span>';
+ }
+
+ if(isset($refactorClass['description'])){
+ echo '<p>', $refactorClass['description'], '</p>';
+ }
+
+ if(count($refactorClass['constants'])){
+ echo '<h3>Constants</h3>';
+ foreach($refactorClass['constants'] as $name => $constant){
+ echo '<p><h4><span class="return-value">', gettype($constant), '</span> ', $name, '</h4></p>';
+ }
+ }
+
+ echo '<h3>Methods</h3>';
+ foreach($refactorClass['methods'] as $name => $method){
+ echo '<div class="method">';
+ echo '<h4>';
+ if($method['return']!='unknown'){
+ echo '<span class="return-value">', $method['return'], '</span> ';
+ }
+ echo '<span class="visibility">', join(' ', $method['modifiers']), '</span> ', $name, '(';
+ $parameters = array();
+ foreach($method['parameters'] as $parameterName => $parameter){
+ if($parameter['optional']){
+ $type = gettype($parameter['default']);
+ switch($type){
+ case 'string':
+ $parameter['default'] = '"'.$parameter['default'].'"';
+ break;
+ case 'boolean':
+ if($parameter['default']){
+ $parameter['default'] = 'true';
+ } else {
+ $parameter['default'] = 'false';
+ };
+ break;
+ case 'NULL';
+ $parameter['default'] = 'null';
+ break;
+ default:
+ $parameter['default'] = $type;
+ break;
+ }
+ $parameters[] = '[<span class="parameter-type">'.$parameter['type'].'</span> '.$parameterName.'='.$parameter['default'].']';
+ } else {
+ $parameters[] = '<span class="parameter-type">'.$parameter['type'].'</span> '.$parameterName;
+ }
+ }
+ echo join(', ', $parameters);
+ echo ')</h4>';
+ echo '<div class="doc"><p>', $method['description'], '<p></div>';
+ echo '</div>';
+ }
+
+}
View
12 app/views/api/index.phtml
@@ -0,0 +1,12 @@
+<?php
+
+require '../refactor.php';
+
+echo '<h2>Framework API</h2>';
+
+echo '<h3>Classes</h3>';
+ksort($refactor);
+foreach($refactor as $className => $value){
+ echo '<h4>', Phalcon_Tag::linkTo(array('api/class/'.$className, $className)), '</h4>';
+}
+echo '</ul>';
View
255 app/views/documentation/acl.phtml
@@ -0,0 +1,255 @@
+<div class="nav-bar">
+ <?php echo Phalcon_Tag::linkTo('index', 'Home') ?> » Documentation
+</div>
+
+<div class="doc-paragraph">
+ <h2>Access Control Lists ACL</h2>
+ This component allows to manage ACL lists.
+ An <a href="http://en.wikipedia.org/wiki/Access_control_list">access control list (ACL)</a> is a list
+ of permissions attached to an object. An ACL specifies that users or system processes are granted
+ access to objects, as well as what operations are allowed on given objects.
+ Phalcon provides the <?php echo Tag::classLink('Phalcon_Acl') ?> to manage access control lists.
+</div>
+
+<div class="doc-paragraph highlight">
+ Before proceeding, we recommend you to read some ACL documentation, as it is important to be familiar
+ with some of the ACL concepts.
+</div>
+
+<div class="doc-paragraph">
+ <h3><a name="creating">Creating an ACL</a></h3>
+ This component is designed to initially work in memory.
+ This will give us the ease of handling rapidly every aspect of the list.
+ The Phalcon_Acl constructor takes as its first parameter a adapter used
+ to recover the information related to the control list. In this example we'll use the memory adapter:
+</div>
+
+<div class="doc-center">
+<?php echo hyperlight('$acl = new Phalcon_Acl("Memory");', 'iphp'); ?>
+</div>
+
+<div class="doc-paragraph">
+ By default Phalcon_Acl allows access to action on resources that has not been defined previously.
+ To increase the security level of our access list we'll define a "deny" level as default access level.
+</div>
+
+<div class="doc-center">
+<?php echo hyperlight('//Default action is deny access
+$acl->setDefaultAction(Phalcon_Acl::DENY);', 'iphp'); ?>
+</div>
+
+<div class="doc-paragraph">
+ <h3><a name="roles">Adding Roles to the ACL</a></h3>
+ A role is somebody or something that could be access to certain resources in the access list. In our example
+ we will define roles as groups of people at an organization. The
+ <?php echo Tag::classLink('Phalcon_Acl_Role') ?> is available to create roles in a more structured way.
+ Let's add some roles to our recently created list:
+</div>
+
+<?php echo hyperlight('
+
+//Create some roles
+$roleAdmins = new Phalcon_Acl_Role("Administrators", "Super-User role");
+$roleGuests = new Phalcon_Acl_Role("Guests");
+
+//Add "Guests" role to acl
+acl->addRole($roleGuests);
+
+//Add "Designers" role to acl without a Phalcon_Acl_Role
+$acl->addRole("Designers");
+
+', 'iphp'); ?>
+
+<div class="doc-paragraph">
+ As you can see, roles also can be defined directly without using a <?php echo Tag::classLink('Phalcon_Acl_Role') ?> instance.
+</div>
+
+<div class="doc-paragraph">
+ <h3><a name="resources">Adding Resources</a></h3>
+ Resources are objects where access is controlled. Normally in MVC applications resources refer to
+ controllers. Although this is not mandatory, <?php echo Tag::classLink('Phalcon_Acl_Resource') ?> can be used defining resources.
+ It's important to add related actions or operations to a resource so ACL can understand what it should to control.
+</div>
+
+<?php echo hyperlight('
+
+//Define the "Customers" resource
+$customersResource = new Phalcon_Acl_Resource("Customers");
+
+//Add "customers" resource with a couple of operations
+$acl->addResource($customersResource, "search");
+$acl->addResource($customersResource, array("create", "update"));
+
+', 'iphp'); ?>
+
+<div class="doc-paragraph">
+ <h3><a name="access">Defining Access Controls</a></h3>
+ Now we've roles and resources. It's time to say to ACL which roles can access which resources.
+ This part is very important because it allows to define the control list itself.
+</div>
+
+<?php echo hyperlight('
+//Set access level for roles into resources
+$acl->allow("Guests", "Customers", "search");
+$acl->allow("Guests", "Customers", "create");
+$acl->deny("Guests", "Customers", "update");
+
+', 'iphp'); ?>
+
+<div class="doc-paragraph">
+ The allow method say to the list: Yes, this role have granted with access to this resource/operation.
+ The deny method does the opposite.
+</div>
+
+<div class="doc-paragraph">
+ <h3><a name="querying">Querying an ACL</a></h3>
+ Once the list has been completely defined. We can begin to query and see if a role has a given permission or not.
+</div>
+
+<?php echo hyperlight('
+//Check whether role has access to the operations
+$acl->isAllowed("Guests", "Customers", "edit"); //Returns 0
+$acl->isAllowed("Guests", "Customers", "search"); //Returns 1
+$acl->isAllowed("Guests", "Customers", "create"); //Returns 1
+', 'iphp');
+?>
+
+<div class="doc-paragraph">
+ <h3><a name="inheritance">Roles Inheritance</a></h3>
+ In some cases, roles permissions could be inherited from another existing roles. You can do this by simply
+ refer the inherited role as the second parameter when defining a role into the list.
+</div>
+
+<?php echo hyperlight('
+
+//Create some roles
+$roleAdmins = new Phalcon_Acl_Role("Administrators", "Super-User role");
+$roleGuests = new Phalcon_Acl_Role("Guests");
+
+//Add "Guests" role to acl
+acl->addRole($roleGuests);
+
+//Add "Administrators" role inheriting from "Guests" its accesses
+$acl->addRole($roleAdmins, $roleGuests);
+
+', 'iphp'); ?>
+
+<div class="doc-paragraph">
+ <h3><a name="serializing">Serializing ACL lists</a></h3>
+ To improve performance Phalcon_Acl instances can be serialized and stored in plain files to avoid
+ continuous definition. You can do that as follows:
+</div>
+
+<?php echo hyperlight('
+
+//Check whether acl data already exist
+if(!file_exists("app/security/acl.data")){
+
+ $acl = new Phalcon_Acl("Memory");
+
+ //... Define roles, resources, access, etc
+
+ //Store serialized list into plain file
+ file_put_contents("app/security/acl.data", serialize($acl));
+
+} else {
+
+ //Restore acl object from serialized file
+ $acl = unserialize(file_get_contents("app/security/acl.data"));
+}
+
+//Use acl list as needed
+if($acl->isAllowed("Guests", "Customers", "edit")){
+ echo "Access granted!";
+} else {
+ echo "Access denied :(";
+}
+
+', 'iphp');
+?>
+
+<div class="doc-paragraph">
+ <h3><a name="controllers">Integrating ACL with Controllers</a></h3>
+ The following example shows how to do a simple integration between ACL and
+ <?php echo Phalcon_Tag::linkTo('documentation/controllers', 'Phalcon_Controller') ?>:
+</div>
+
+<?php echo hyperlight('<?php
+
+class PostsController extends Phalcon_Controller {
+
+ private $_acl = null;
+
+ /**
+ * Gets a Phalcon_Acl instance
+ */
+ private function _getAcl(){
+
+ //Only create an ACL once by request
+ if(!$this->_acl){
+
+ $acl = new Phalcon_Acl("Memory");
+
+ $acl->addResource("posts", array("index", "create"));
+
+ //Set access to Public role
+ $acl->addRole("Public");
+ $acl->allow("Public", "posts", "index");
+
+ //Set access to Users role
+ $acl->addRole("Users");
+ $acl->allow("Users", "posts", "index");
+ $acl->deny("Users", "posts", "create");
+
+ $this->_acl = $acl;
+ }
+
+ return $this->_acl;
+ }
+
+ /**
+ * Returns the user profile in session
+ */
+ private function _getUser(){
+ if(Phalcon_Session::has("authInfo")){
+ return Phalcon_Session::get("authInfo");
+ } else {
+ return array(
+ "Profile" => "Public"
+ );
+ }
+ }
+
+ /**
+ * beforeDispatch is executed before every action in the controller
+ */
+ function beforeDispatch($controllerName, $actionName){
+
+ $acl = $this->_getAcl();
+ $user = $this->_getUser();
+
+ if(!$acl->isAllowed($user["Profile"], $controllerName, $actionName)){
+ //Forward flow to another controller if user does not have permission
+ $this->_forward("index/index");
+ return false;
+ }
+
+ }
+
+}
+
+', 'php');
+?>
+
+<div class="nav-bar">
+ <table width="90%" align="center">
+ <tr>
+ <td align="left">
+ <?php echo Phalcon_Tag::linkTo('documentation/cache', '← Improving Performance with Cache') ?>
+ </td>
+ <td align="right">
+ <?php echo Phalcon_Tag::linkTo('documentation/intl', 'Internationalization →') ?>
+ </td>
+ </tr>
+ </table>
+</div>
View
613 app/views/documentation/benchmark.phtml
@@ -0,0 +1,613 @@
+
+<div class="nav-bar">
+ <?php echo Phalcon_Tag::linkTo('index', 'Home') ?> » Documentation
+</div>
+
+<script type="text/javascript" src="https://www.google.com/jsapi"></script>
+
+<script type="text/javascript">
+google.load("visualization", "1", {packages:["corechart"]});
+google.setOnLoadCallback(drawChart);
+
+function drawChart() {
+
+ var data = new google.visualization.DataTable();
+ data.addColumn('string', 'Framework');
+ data.addColumn('number', 'Requests per second');
+ data.addRows([
+ ['Symfony', 123.37],
+ ['Zend', 234.53],
+ ['Kohana', 623.77],
+ ['Yii', 680.82],
+ ['CodeIgniter', 844.63],
+ ['Phalcon', 2599.46]
+ ]);
+
+ var options = {
+ title: 'Framework / Requests per second (#/sec) [more is better]',
+ colors: ['#3366CC'],
+ animation: {
+ duration: 0.5
+ },
+ fontSize: 12,
+ chartArea: {
+ width: '600px'
+ }
+ };
+
+ var chart = new google.visualization.ColumnChart(document.getElementById('rps_div'));
+ chart.draw(data, options);
+
+ var data = new google.visualization.DataTable();
+ data.addColumn('string', 'Framework');
+ data.addColumn('number', 'Time per Request');
+ data.addRows([
+ ['Symfony', 8.105],
+ ['Zend', 4.264],
+ ['Kohana', 1.603],
+ ['Yii', 1.469],
+ ['CodeIgniter', 1.184],
+ ['Phalcon', 0.385]
+ ]);
+
+ var options = {
+ title: 'Framework / Time per Request (mean, across all concurrent requests) [less is better]',
+ colors: ['#3366CC'],
+ fontSize: 11
+ };
+
+ var chart = new google.visualization.ColumnChart(document.getElementById('tpr_div'));
+ chart.draw(data, options);
+
+ var data = new google.visualization.DataTable();
+ data.addColumn('string', 'Framework');
+ data.addColumn('number', 'Memory Usage (MB)');
+ data.addRows([
+ ['Yii', 3.50],
+ ['Symfony', 3.0],
+ ['Zend', 1.75],
+ ['Kohana', 1.25],
+ ['CodeIgniter', 1.1],
+ ['Phalcon', 0.75]
+ ]);
+
+ var options = {
+ title: 'Framework / Memory Usage (mean, megabytes per request) [less is better]',
+ colors: ['#3366CC'],
+ fontSize: 11
+ };
+
+ var chart = new google.visualization.ColumnChart(document.getElementById('mpr_div'));
+ chart.draw(data, options);
+
+ var data = new google.visualization.DataTable();
+ data.addColumn('string', 'Framework');
+ data.addColumn('number', 'Number of included PHP files');
+ data.addRows([
+ ['Symfony', 115],
+ ['Zend', 66],
+ ['Kohana', 46],
+ ['Yii', 36],
+ ['CodeIgniter', 23],
+ ['Phalcon', 4]
+ ]);
+
+ var options = {
+ title: 'Framework / Number of included PHP files (mean, number on a single request) [less is better]',
+ colors: ['#3366CC'],
+ fontSize: 11
+ };
+
+ var chart = new google.visualization.ColumnChart(document.getElementById('nfi_div'));
+ chart.draw(data, options);
+
+}
+</script>
+
+<div class="doc-paragraph">
+ <h2>Framework Benchmark</h2>
+ Before, performance is not the most important thing when developing web applications, but,
+ for example, Google <a href="http://googlewebmastercentral.blogspot.com/2010/04/using-site-speed-in-web-search-ranking.html">decided</a>
+ to take site speed into account in the search rankings. This is yet another
+ way in which improving web performance will have a positive impact.
+</div>
+
+<div class="doc-paragraph">
+ Benchmarking below shows how efficient Phalcon is when compared with other traditional PHP frameworks.
+ This benchmark is updated as stable versions are released from any of the frameworks mentioned or Phalcon itself.
+</div>
+
+<div class="doc-paragraph highlight">
+ We allow you to clone the suite we use for testing. You can download it to check which code was used
+ to test the performance. If you have any additional optimizations or comments please <a href="http://phalcon.uservoice.com/">write us.</a> <a href="https://github.com/phalcon/framework-bench">Check out source at Github</a>
+</div>
+
+<div class="doc-paragraph highlightb">
+ <b>Update Mar-20-2012:</b> Benchmarks was remade changing the apc.stat setting to Off. <a href="http://www.php.net/manual/en/apc.configuration.php#ini.apc.stat">More Info</a>
+</div>
+
+<div class="doc-paragraph">
+ <h3><a name="benchmark-made">How the bechmark was made?</a></h3>
+ We made a "Hello World" benchmark looking to identify the minimal load overhead of each framework.
+ Many people don't like this kind of benchmark because real-world applications
+ need more complex features. However, these tests you will understand how much is the
+ minimum time spent by each framework to perform a simple task. A task like this, is the minimal task
+ that runs on every request made to an application.
+</div>
+
+<div class="doc-paragraph">
+ A controller and a view have been created for each framework. The controller "say" and action "hello". Action only
+ gives pass to the view for say "Hello!". Using the "ab" benchmark tool we sent 1000 requests using 5 concurrent connections to each framework.
+</div>
+
+<div class="doc-paragraph">
+ <h3><a name="measures-taken">What measures does were taken?</a></h3>
+ These were the measurements we take to measure the overall performance of the frameworks:
+ <ul>
+ <li>Requests per second</li>
+ <li>Time across all concurrent requests</li>
+ <li>Number of included PHP files on a single request (measured using function <a href="http://www.php.net/manual/en/function.get-included-files.php">get_included_files()</a></li>
+ <li>Memory Usage per request (measured using function <a href="http://php.net/manual/en/function.memory-get-usage.php">memory_get_usage()</a></li>
+ </ul>
+</div>
+
+<div class="doc-paragraph">
+ <h3><a name="test-environment">What was the test environment?</a></h3>
+ <a href="http://php.net/manual/en/book.apc.php">APC</a> intermediate code cache was enabled for all frameworks. Any Apache mod-rewrite feature
+ was disabled to avoid possible extra overheads.
+</div>
+
+<div class="doc-paragraph">
+ The testing hardware environment is as follows:
+<ul>
+ <li>Operating System: Mac OS X Snow Leopard 10.6.8
+ <li>Web Server: Apache httpd 2.2.21
+ <li>PHP: 5.3.8
+ <li>CPU: 3.06 Ghz Intel Core 2 Duo
+ <li>Main Memory: 4GB 1067 MHz DDR3
+ <li>Hard Drive: 500GB SCSI/SAS HDD
+</ul>
+
+</div>
+
+<div class="doc-paragraph">
+ <i>PHP version and info:</i>
+ <div align="center">
+ <?php echo Phalcon_Tag::image('img/bench-1.png') ?>
+ </div>
+</div>
+
+<div class="doc-paragraph">
+ <i>Apache environment:</i>
+ <div align="center">
+ <?php echo Phalcon_Tag::image('img/bench-2.png') ?>
+ </div>
+</div>
+
+<div class="doc-paragraph">
+ <i>APC settings:</i>
+ <div align="center">
+ <?php echo Phalcon_Tag::image('img/bench-3.png') ?>
+ </div>
+</div>
+
+<div class="doc-paragraph">
+ <h3>Yii (YII_DEBUG=false) Version yii-1.1.10.r3566</h3>
+ <a href="http://www.yiiframework.com/">Yii</a> is a high-performance PHP framework best
+ for developing Web 2.0 applications. Version used for benchmark was yii-1.1.10.r3566.
+ We disable YII_DEBUG for get faster perfomance.
+</div>
+
+<pre class="source-code php">
+ab -n 1000 -c 5 http://localhost/bench/yii/index.php?r=say/hello
+This is ApacheBench, Version 2.3 <$Revision: 655654 $>
+Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
+Licensed to The Apache Software Foundation, http://www.apache.org/
+
+Benchmarking localhost (be patient)
+Completed 100 requests
+Completed 200 requests
+Completed 300 requests
+Completed 400 requests
+Completed 500 requests
+Completed 600 requests
+Completed 700 requests
+Completed 800 requests
+Completed 900 requests
+Completed 1000 requests
+Finished 1000 requests
+
+
+Server Software: Apache/2.2.21
+Server Hostname: localhost
+Server Port: 80
+
+Document Path: /bench/yii/index.php?r=say/hello
+Document Length: 61 bytes
+
+Concurrency Level: 5
+Time taken for tests: 1.469 seconds
+Complete requests: 1000
+Failed requests: 0
+Write errors: 0
+Total transferred: 232232 bytes
+HTML transferred: 61061 bytes
+Requests per second: 680.82 [#/sec] (mean)
+Time per request: 7.344 [ms] (mean)
+Time per request: 1.469 [ms] (mean, across all concurrent requests)
+Transfer rate: 154.40 [Kbytes/sec] received
+
+Connection Times (ms)
+ min mean[+/-sd] median max
+Connect: 0 1 1.1 0 5
+Processing: 2 6 7.5 5 80
+Waiting: 0 6 7.0 4 80
+Total: 2 7 7.5 5 81
+
+Percentage of the requests served within a certain time (ms)
+ 50% 5
+ 66% 6
+ 75% 8
+ 80% 8
+ 90% 11
+ 95% 18
+ 98% 31
+ 99% 49
+ 100% 81 (longest request)
+</pre>
+<br/>
+
+<div class="doc-paragraph">
+ <h3>Symfony Version 2.0.11</h3>
+ <a href="http://symfony.com/">Symfony</a> is another high-performance PHP framework.
+</div>
+
+<pre class="source-code php">
+[#] ab -n 1000 -c 5 http://localhost/bench/Symfony/web/app.php/say/hello/
+This is ApacheBench, Version 2.3 <$Revision: 655654 $>
+Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
+Licensed to The Apache Software Foundation, http://www.apache.org/
+
+Benchmarking localhost (be patient)
+Completed 100 requests
+Completed 200 requests
+Completed 300 requests
+Completed 400 requests
+Completed 500 requests
+Completed 600 requests
+Completed 700 requests
+Completed 800 requests
+Completed 900 requests
+Completed 1000 requests
+Finished 1000 requests
+
+
+Server Software: Apache/2.2.21
+Server Hostname: localhost
+Server Port: 80
+
+Document Path: /bench/Symfony/web/app.php/say/hello/
+Document Length: 16 bytes
+
+Concurrency Level: 5
+Time taken for tests: 8.105 seconds
+Complete requests: 1000
+Failed requests: 0
+Write errors: 0
+Total transferred: 270000 bytes
+HTML transferred: 16000 bytes
+Requests per second: 123.37 [#/sec] (mean)
+Time per request: 40.527 [ms] (mean)
+Time per request: 8.105 [ms] (mean, across all concurrent requests)
+Transfer rate: 32.53 [Kbytes/sec] received
+
+Connection Times (ms)
+ min mean[+/-sd] median max
+Connect: 0 1 1.8 0 23
+Processing: 14 40 38.2 26 262
+Waiting: 6 39 37.9 25 260
+Total: 14 40 38.4 26 266
+
+Percentage of the requests served within a certain time (ms)
+ 50% 26
+ 66% 35
+ 75% 44
+ 80% 51
+ 90% 80
+ 95% 137
+ 98% 178
+ 99% 206
+ 100% 266 (longest request)
+</pre>
+<br/>
+
+<div class="doc-paragraph">
+ <h3>Zend Framework Version 1.11.11</h3>
+ <a href="http://framework.zend.com">Zend Framework</a> is an open source, object oriented web application framework for PHP 5.
+ Zend framework was installed on a Apache VirtualHost.
+</div>
+
+<pre class="source-code php">
+[#] ab -n 1000 -c 5 http://zend.local/say/hello
+This is ApacheBench, Version 2.3 <$Revision: 655654 $>
+Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
+Licensed to The Apache Software Foundation, http://www.apache.org/
+
+Benchmarking zend.local (be patient)
+Completed 100 requests
+Completed 200 requests
+Completed 300 requests
+Completed 400 requests
+Completed 500 requests
+Completed 600 requests
+Completed 700 requests
+Completed 800 requests
+Completed 900 requests
+Completed 1000 requests
+Finished 1000 requests
+
+
+Server Software: Apache/2.2.21
+Server Hostname: zend.local
+Server Port: 80
+
+Document Path: /say/hello
+Document Length: 16 bytes
+
+Concurrency Level: 5
+Time taken for tests: 4.264 seconds
+Complete requests: 1000
+Failed requests: 0
+Write errors: 0
+Total transferred: 187000 bytes
+HTML transferred: 16000 bytes
+Requests per second: 234.53 [#/sec] (mean)
+Time per request: 21.320 [ms] (mean)
+Time per request: 4.264 [ms] (mean, across all concurrent requests)
+Transfer rate: 42.83 [Kbytes/sec] received
+
+Connection Times (ms)
+ min mean[+/-sd] median max
+Connect: 0 1 1.5 0 8
+Processing: 7 20 20.1 13 147
+Waiting: 0 20 19.7 13 147
+Total: 7 21 20.1 14 148
+
+Percentage of the requests served within a certain time (ms)
+ 50% 14
+ 66% 18
+ 75% 23
+ 80% 27
+ 90% 46
+ 95% 62
+ 98% 93
+ 99% 116
+ 100% 148 (longest request)
+</pre>
+
+<div class="doc-paragraph">
+ <h3>CodeIgniter 2.1.0</h3>
+ <a href="http://codeigniter.com/">CodeIgniter</a> is a powerful PHP framework with a very small footprint,
+ built for PHP coders who need a simple and elegant toolkit to create full-featured web applications.
+</div>
+
+<pre class="source-code php">
+[#] ab -n 1000 -c 5 http://localhost/bench/codeigniter/index.php/say/hello
+This is ApacheBench, Version 2.3 <$Revision: 655654 $>
+Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
+Licensed to The Apache Software Foundation, http://www.apache.org/
+
+Benchmarking localhost (be patient)
+Completed 100 requests
+Completed 200 requests
+Completed 300 requests
+Completed 400 requests
+Completed 500 requests
+Completed 600 requests
+Completed 700 requests
+Completed 800 requests
+Completed 900 requests
+Completed 1000 requests
+Finished 1000 requests
+
+
+Server Software: Apache/2.2.21
+Server Hostname: localhost
+Server Port: 80
+
+Document Path: /bench/codeigniter/index.php/say/hello
+Document Length: 16 bytes
+
+Concurrency Level: 5
+Time taken for tests: 1.184 seconds
+Complete requests: 1000
+Failed requests: 0
+Write errors: 0
+Total transferred: 187000 bytes
+HTML transferred: 16000 bytes
+Requests per second: 844.63 [#/sec] (mean)
+Time per request: 5.920 [ms] (mean)
+Time per request: 1.184 [ms] (mean, across all concurrent requests)
+Transfer rate: 154.24 [Kbytes/sec] received
+
+Connection Times (ms)
+ min mean[+/-sd] median max
+Connect: 0 1 0.7 0 5
+Processing: 2 5 11.0 4 148
+Waiting: 0 5 10.8 4 148
+Total: 2 6 10.9 4 148
+WARNING: The median and mean for the initial connection time are not within a normal deviation
+ These results are probably not that reliable.
+
+Percentage of the requests served within a certain time (ms)
+ 50% 4
+ 66% 4
+ 75% 5
+ 80% 6
+ 90% 8
+ 95% 12
+ 98% 24
+ 99% 38
+ 100% 148 (longest request)
+</pre>
+
+<div class="doc-paragraph">
+ <h3>Kohana 3.2.0</h3>
+ <a href="http://kohanaframework.org/index">Kohana</a> is an elegant HMVC PHP5 framework that provides a
+ rich set of components for building web applications.
+</div>
+
+<pre class="source-code php">
+[#] ab -n 1000 -c 5 http://localhost/bench/kohana/index.php/say/hello
+This is ApacheBench, Version 2.3 <$Revision: 655654 $>
+Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
+Licensed to The Apache Software Foundation, http://www.apache.org/
+
+Benchmarking localhost (be patient)
+Completed 100 requests
+Completed 200 requests
+Completed 300 requests
+Completed 400 requests
+Completed 500 requests
+Completed 600 requests
+Completed 700 requests
+Completed 800 requests
+Completed 900 requests
+Completed 1000 requests
+Finished 1000 requests
+
+
+Server Software: Apache/2.2.21
+Server Hostname: localhost
+Server Port: 80
+
+Document Path: /bench/kohana/index.php/say/hello
+Document Length: 15 bytes
+
+Concurrency Level: 5
+Time taken for tests: 1.603 seconds
+Complete requests: 1000
+Failed requests: 0
+Write errors: 0
+Total transferred: 186000 bytes
+HTML transferred: 15000 bytes
+Requests per second: 623.77 [#/sec] (mean)
+Time per request: 8.016 [ms] (mean)
+Time per request: 1.603 [ms] (mean, across all concurrent requests)
+Transfer rate: 113.30 [Kbytes/sec] received
+
+Connection Times (ms)
+ min mean[+/-sd] median max
+Connect: 0 1 0.9 0 5
+Processing: 2 7 22.4 5 317
+Waiting: 0 7 22.3 4 317
+Total: 2 8 22.3 5 318
+WARNING: The median and mean for the initial connection time are not within a normal deviation
+ These results are probably not that reliable.
+
+Percentage of the requests served within a certain time (ms)
+ 50% 5
+ 66% 5
+ 75% 6
+ 80% 7
+ 90% 10
+ 95% 17
+ 98% 33
+ 99% 46
+ 100% 318 (longest request)
+</pre>
+
+<br/>
+<div class="doc-paragraph">
+ <h3>Phalcon Version 0.3.1</h3>
+</div>
+
+<pre class="source-code php">
+ab -n 1000 -c 5 http://localhost/bench/phalcon/?_url=say/hello
+This is ApacheBench, Version 2.3 <$Revision: 655654 $>
+Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
+Licensed to The Apache Software Foundation, http://www.apache.org/
+
+Benchmarking localhost (be patient)
+Completed 100 requests
+Completed 200 requests
+Completed 300 requests
+Completed 400 requests
+Completed 500 requests
+Completed 600 requests
+Completed 700 requests
+Completed 800 requests
+Completed 900 requests
+Completed 1000 requests
+Finished 1000 requests
+
+
+Server Software: Apache/2.2.21
+Server Hostname: localhost
+Server Port: 80
+
+Document Path: /bench/phalcon/?_url=say/hello
+Document Length: 16 bytes
+
+Concurrency Level: 5
+Time taken for tests: 0.385 seconds
+Complete requests: 1000
+Failed requests: 0
+Write errors: 0
+Total transferred: 187000 bytes
+HTML transferred: 16000 bytes
+Requests per second: 2599.46 [#/sec] (mean)
+Time per request: 1.923 [ms] (mean)
+Time per request: 0.385 [ms] (mean, across all concurrent requests)
+Transfer rate: 474.71 [Kbytes/sec] received
+
+Connection Times (ms)
+ min mean[+/-sd] median max
+Connect: 0 0 0.3 0 3
+Processing: 1 2 1.9 1 43
+Waiting: 0 1 1.8 1 43
+Total: 1 2 1.9 2 43
+
+Percentage of the requests served within a certain time (ms)
+ 50% 2
+ 66% 2
+ 75% 2
+ 80% 2
+ 90% 3
+ 95% 4
+ 98% 5
+ 99% 9
+ 100% 43 (longest request)
+</pre>
+
+<div class="doc-paragraph">
+ <h3>Result Graphs</h3>
+ The first graph shows how many requests per second each framework was able to accept.
+ Second shows the average time across all concurrent requests.
+</div>
+
+<div align="center">
+ <div id="rps_div" style="width: 600px; height: 400px;"></div>
+ <div id="tpr_div" style="width: 600px; height: 400px;"></div>
+ <div id="nfi_div" style="width: 600px; height: 400px;"></div>
+ <div id="mpr_div" style="width: 600px; height: 400px;"></div>
+</div>
+
+<div class="doc-paragraph">
+ <h3>Conclusion</h3>
+ The Phalcon compiled nature offers extraordinary performance that outperforms all other frameworks in this comparison.
+ Phalcon is a real high performance framework that allow you to scale more easily than ever.
+</div>
+
+<div class="nav-bar">
+ <table width="90%" align="center">
+ <tr>
+ <td align="left">
+ <?php echo Phalcon_Tag::linkTo('documentation/motivation', '← Our Motivation') ?>
+ </td>
+ <td align="right">
+ <?php echo Phalcon_Tag::linkTo('documentation/install', 'Installation →') ?>
+ </td>
+ </tr>
+ </table>
+</div>
View
113 app/views/documentation/cache.phtml
@@ -0,0 +1,113 @@
+
+<div class="nav-bar">
+ <?php echo Phalcon_Tag::linkTo('index', 'Home') ?> » Documentation
+</div>
+
+<div class="doc-paragraph">
+ <h2>Improving Performance with Cache</h2>
+ Phalcon provides the <?php echo Tag::classLink('Phalcon_Cache') ?>, it help us to cache output fragments
+ avoiding the continuous reprocessing of code that every time returns the same output.
+</div>
+
+<div class="doc-paragraph">
+ Phalcon_Cache is very similar to the Zend Framework counterpart but is written in C to reach high performance.
+ This component uses a internal structure of frontends and backends. Frontends acts as input sources and
+ backends provides storage features.
+</div>
+
+<div class="doc-paragraph">
+ The following example shows how to implement a cache using this component. It takes the output generated
+ by PHP and stores it into a file. The content of the file is refreshed each 172800 seconds (2 days).
+ The implementation of the cache avoids the continuous execution of the helper Phalcon_Tag::linkTo:
+</div>
+
+<div class="doc-center">
+<?php echo hyperlight('<?php
+
+//Cache the files for 2 days
+$frontendOptions = array(
+ "lifetime" => 172800
+);
+
+//Set the cache files directory
+$backendOptions = array(
+ "cacheDir" => "../app/cache/"
+);
+
+//Create a cache that caches from the "Output" to a "File" backend
+$cache = Phalcon_Cache::factory("Output", "File",
+ $frontendOptions, $backendOptions);
+
+//Get/Set the cache file to ../app/cache/my-cache.html
+$content = $cache->start("my-cache.html");
+
+//If $content is null then the content will be created or will refreshed
+if($content===null){
+
+ //Generate a link to the sign-up action
+ echo Phalcon_Tag::linkTo(array(
+ "user/signup",
+ "Sign Up",
+ "class" => "signup-button"
+ ));
+
+ //Stores the output into cache file
+ $cache->save();
+} else {
+
+ //Echo the cached output
+ echo $content;
+}
+', 'php');
+
+?>
+</div>
+
+<div class="doc-paragraph">
+ <h3><a name="frontend">Frontend Adapters</a></h3>
+ This component makes use of frontend adapters to encapsulate the different input sources to cache.
+</div>
+
+<div class="doc-paragraph">
+ <table align="center" cellspacing="0">
+ <tr>
+ <th>Adapter</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td>Output</td>
+ <td>Read input data from standard PHP output</td>
+ </tr>
+ </table>
+</div>
+
+<div class="doc-paragraph">
+ <h3><a name="backend">Backend Adapters</a></h3>
+ This component also makes use of backend adapters to encapsulate storage related details of the cache.
+</div>
+
+<div class="doc-paragraph">
+ <table align="center" cellspacing="0">
+ <tr>
+ <th>Adapter</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td>File</td>
+ <td>Stored cached data to local plain files</td>
+ </tr>
+ </table>
+</div>
+
+<div class="nav-bar">
+ <table width="90%" align="center">
+ <tr>
+ <td align="left">
+ <?php echo Phalcon_Tag::linkTo('documentation/pagination', '← Data Pagination') ?>
+ </td>
+ <td align="right">
+ <?php echo Phalcon_Tag::linkTo('documentation/acl', 'Access Control Lists (ACL) →') ?>
+ </td>
+ </tr>
+ </table>
+</div>
View
127 app/views/documentation/config.phtml
@@ -0,0 +1,127 @@
+
+<div class="nav-bar">
+ <?php echo Phalcon_Tag::linkTo('index', 'Home') ?> » Documentation
+</div>
+
+<div class="doc-paragraph">
+ <h2>Reading Configuration</h2>
+ The component <?php echo Tag::classLink('Phalcon_Config') ?> allows to read configuration files in
+ different formats into PHP objects facilitating the reading thereof.
+</div>
+
+<div class="doc-paragraph">
+ <h3><a name="adapters">File Adapters</a></h3>
+ This component makes use of adapters to encapsulate the reading details of each format:
+</div>
+
+<div class="doc-paragraph">
+ <table align="center" cellspacing="0">
+ <tr>
+ <th>File Type</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td>Ini</td>
+ <td>Uses INI files to store settings. Internally it uses the PHP function parse_ini_file.</td>
+ </tr>
+ <tr>
+ <td>Array</td>
+ <td>Uses PHP multidimensional arrays to store the configuration. In terms of performance is the best.</td>
+ </tr>
+ </table>
+</div>
+
+<div class="doc-paragraph">
+ <h3><a name="arrays">Native Arrays</a></h3>
+ The next example shows how to convert native arrays into Phalcon_Config objects. Because no files are read
+ the performance is better.
+</div>
+
+<?php echo hyperlight('<?php
+
+$settings = array(
+ "database" => array(
+ "adapter" => "Mysql",
+ "host" => "localhost",
+ "username" => "scott",
+ "password" => "cheetah",
+ "name" => "test_db"
+ ),
+ "phalcon" => array(
+ "controllersDir" => "../app/controllers/",
+ "modelsDir" => "../app/models/",
+ "viewsDir" => "../app/views/"
+ ),
+ "mysetting" => "the-value"
+);
+
+$config = new Phalcon_Config($settings);
+
+echo $config->phalcon->controllersDir, "\n";
+echo $config->database->username, "\n";
+echo $config->mysetting, "\n";
+
+', 'php'); ?>
+
+<div class="doc-paragraph">
+If you want to better organize your project you can save the array in another file and then read it.
+</div>
+
+<?php echo hyperlight('<?php
+
+require "config/config.php";
+$config = new Phalcon_Config($settings);
+
+', 'php'); ?>
+
+<div class="doc-paragraph">
+ <h3>Reading INI Files</h3>
+ Ini files are a common way to store settings. Phalcon_Config uses the optimized
+ php function parse_ini_file to read these files. File sections are parsed into sub-settings that
+ can be accessed then.
+</div>
+
+<?php echo hyperlight('
+[database]
+adapter = Mysql
+host = localhost
+username = scott
+password = cheetah
+name = test_db
+
+[phalcon]
+controllersDir = "../app/controllers/"
+modelsDir = "../app/models/"
+viewsDir = "../app/views/"
+
+', 'php'); ?>
+
+<?php echo hyperlight('<?php
+
+$config = new Phalcon_Config_Adapter_Ini("path/config.ini");
+
+echo $config->phalcon->controllersDir, "\n";
+echo $config->database->username, "\n";
+
+', 'php'); ?>
+
+
+<div class="doc-paragraph">
+ <h3>Related Guides</h3>
+ <ul>
+ <li><?php echo Phalcon_Tag::linkTo('documentation/settings', 'Settings supported by the Framework') ?></li>
+ </ul>
+</div>
+
+<div class="nav-bar">
+ <table width="90%" align="center">
+ <tr>
+ <td align="left">
+ <?php echo Phalcon_Tag::linkTo('documentation/filter', '← Filtering and Sanitizing') ?>
+ </td>
+ <td align="right">
+ <?php echo Phalcon_Tag::linkTo('documentation/pagination', 'Data Pagination →') ?>
+ </td>
+ </tr>
+ </table>
+</div>
View
266 app/views/documentation/controllers.phtml
@@ -0,0 +1,266 @@
+
+<div class="nav-bar">
+ <?php echo Phalcon_Tag::linkTo('index', 'Home') ?> » Documentation
+</div>
+
+<div class="doc-paragraph">
+ <h2>Using Controllers</h2>
+ Controllers provide a number of methods that are called actions. Actions are methods on a controller that
+ handle requests. By default all public methods on a controller are an action, and accessible from a url.
+ Actions are responsible for interpreting the request and creating the response.
+ Usually responses are in the form of a rendered view, but there are other ways to create responses as well.
+</div>
+
+<div class="doc-paragraph">
+ For example, when you access a URL like this: <i>http://localhost/blog/posts/show/2012/the-post-title</i>
+ Phalcon by default will process each part like this:
+</div>
+
+<div class="doc-paragraph">
+ <table align="center" cellspacing="0">
+ <tr>
+ <td align="right"><b>Phalcon Directory</b></td>
+ <td>blog</td>
+ </tr>
+ <tr>
+ <td align="right"><b>Controller</b></td>
+ <td>posts</td>
+ </tr>
+ <tr>
+ <td align="right"><b>Action</b></td>
+ <td>show</td>
+ </tr>
+ <tr>
+ <td align="right"><b>Parameter</b></td>
+ <td>2012</td>
+ </tr>
+ <tr>
+ <td align="right"><b>Parameter</b></td>
+ <td>the-post-title</td>
+ </tr>
+ </table>
+</div>
+
+<div class="doc-paragraph">
+ A PostsController will handle this request. The controller will look up in the controllers directory.
+ Controllers should have the suffix "Controller" while actions the suffix "Action". It would be like:
+</div>
+
+<?php echo hyperlight('<?php
+
+class PostsController extends Phalcon_Controller {
+
+ function indexAction(){
+
+ }
+
+ function showAction($year, $postTitle){
+
+ }
+
+}', 'php'); ?>
+
+<div class="doc-paragraph">
+ As you can see aditional URI parameters become method parameters. So you can access it easily as local variables.
+</div>
+
+<div class="doc-paragraph">
+ <h3><a name="dispatch-loop">Dispatch Loop</a></h3>
+ The dispatch loop will be executed within the Dispatcher until there are not pendent actions for execution.
+ In the previous example only once action was executed. Now we'll see how forward the execution flow
+ to another controller/action.
+</div>
+
+<?php echo hyperlight('<?php
+
+class PostsController extends Phalcon_Controller {
+
+ function indexAction(){
+
+ }
+
+ function showAction($year, $postTitle){
+ Phalcon_Flash::error("You don\'t have permission to access this area");
+ //Forward flow to another action
+ $this->_forward("users/signin");
+ }
+
+}', 'php'); ?>
+
+<div class="doc-paragraph">
+ If users doesn't have permissions to access a certain action then will be forwarded to another controller.
+</div>
+
+<?php echo hyperlight('<?php
+
+class UsersController extends Phalcon_Controller {
+
+ function indexAction(){
+
+ }
+
+ function signinAction(){
+
+ }
+
+}', 'php'); ?>
+
+<div class="doc-paragraph">
+ You may do many "forwards" as you require. When there are not pendent actions and dispatch loop will reached the end,
+ Phalcon automatically will pull down the view part of MVC manages by <?php echo Tag::classLink('Phalcon_View') ?>.
+</div>
+
+<div class="doc-paragraph">
+ <h3><a name="initializing">Initializing Controllers</a></h3>
+ When you implement the "initialize" method on any controller, it will be executed the first time an action
+ is requested to a certain controller. The use of the "__construct" method is not recommend.
+</div>
+
+<?php
+
+echo hyperlight('<?php
+
+class PostsController extends Phalcon_Controller {
+
+ function initialize(){
+ $this->config = array(
+ "mySetting" => "value"
+ );
+ }
+
+ function saveAction(){
+ if($this->_config["mySetting"] == "value"){
+ ...
+ }
+ }
+
+}
+
+', 'php'); ?>
+
+<div class="doc-paragraph">
+ <h3><a name="dispatch-events">Dispatch Events</a></h3>
+ Events enable controllers to run shared pre- and post-processing code for its actions.
+ Every time a controller action is executed, two events are provided to check security conditions or modify the application control flow.
+ Those events are "beforeDispatch" and "afterDispatch". The first one is executed before the controller action is dispatched, developers
+ can change control flow by using a forward in that event. The second one is "afterDispatch" event but is execute after
+ controller action.
+</div>
+
+<?php
+
+echo hyperlight('<?php
+
+class PostsController extends Phalcon_Controller {
+
+ function beforeDispatch(){
+ if (Phalcon_Session::get("hasAuth") == false) {
+ //Check whether user is authenticated and forwards him to login if not
+ $this->_forward("session/login");
+ return false;
+ }
+ }
+
+ function indexAction(){
+
+ }
+
+}
+
+', 'php'); ?>
+
+<div class="doc-paragraph">
+ <h3><a name="request-response">Request and Response</a></h3>
+ In every controller there are two public properties pointing to the request and the response
+ objects associated with the request cycle that is currently in execution. The `request` method
+ contains an instance of <?php echo Tag::classLink('Phalcon_Request') ?> and the `response` method contains the response
+ object representing what is going to be sent back to the client.
+</div>
+
+<?php
+
+echo hyperlight('<?php
+
+class PostsController extends Phalcon_Controller {
+
+ function indexAction(){
+
+ }
+
+ function saveAction(){
+
+ //Check if request has made with POST
+ if ($this->request->isPost() == true) {
+
+ //Access POST data
+ $customerName = $this->request->getPost("name");
+ $customerBorn = $this->request->getPost("born");
+
+ }
+
+ }
+
+}
+
+', 'php'); ?>
+
+<div class="doc-paragraph">
+ The response object is not usually used directly, but is built up during the execution of the
+ action and rendering of the data that is being sent back to the user,
+ but sometimes - like in an after dispatch event - it can be useful to access the response directly.
+</div>
+
+<?php
+
+echo hyperlight('<?php
+
+class PostsController extends Phalcon_Controller {
+
+ function indexAction(){
+
+ }