PageRenderTime 48ms CodeModel.GetById 35ms RepoModel.GetById 1ms app.codeStats 0ms

/www/vendor/slim/slim/index.php

https://bitbucket.org/adaltan/parkavn-git
PHP | 163 lines | 112 code | 10 blank | 41 comment | 2 complexity | c8403759ee648de7c6ce571318864a65 MD5 | raw file
  1. <?php
  2. /**
  3. * Step 1: Require the Slim PHP 5 Framework
  4. *
  5. * If using the default file layout, the `Slim/` directory
  6. * will already be on your include path. If you move the `Slim/`
  7. * directory elsewhere, ensure that it is added to your include path
  8. * or update this file path as needed.
  9. */
  10. require 'Slim/Slim.php';
  11. /**
  12. * Step 2: Instantiate the Slim application
  13. *
  14. * Here we instantiate the Slim application with its default settings.
  15. * However, we could also pass a key-value array of settings.
  16. * Refer to the online documentation for available settings.
  17. */
  18. $app = new Slim();
  19. /**
  20. * Step 3: Define the Slim application routes
  21. *
  22. * Here we define several Slim application routes that respond
  23. * to appropriate HTTP request methods. In this example, the second
  24. * argument for `Slim::get`, `Slim::post`, `Slim::put`, and `Slim::delete`
  25. * is an anonymous function. If you are using PHP < 5.3, the
  26. * second argument should be any variable that returns `true` for
  27. * `is_callable()`. An example GET route for PHP < 5.3 is:
  28. *
  29. * $app = new Slim();
  30. * $app->get('/hello/:name', 'myFunction');
  31. * function myFunction($name) { echo "Hello, $name"; }
  32. *
  33. * The routes below work with PHP >= 5.3.
  34. */
  35. //GET route
  36. $app->get('/', function () {
  37. $template = <<<EOT
  38. <!DOCTYPE html>
  39. <html>
  40. <head>
  41. <meta charset="utf-8"/>
  42. <title>Slim Framework for PHP 5</title>
  43. <style>
  44. html,body,div,span,object,iframe,
  45. h1,h2,h3,h4,h5,h6,p,blockquote,pre,
  46. abbr,address,cite,code,
  47. del,dfn,em,img,ins,kbd,q,samp,
  48. small,strong,sub,sup,var,
  49. b,i,
  50. dl,dt,dd,ol,ul,li,
  51. fieldset,form,label,legend,
  52. table,caption,tbody,tfoot,thead,tr,th,td,
  53. article,aside,canvas,details,figcaption,figure,
  54. footer,header,hgroup,menu,nav,section,summary,
  55. time,mark,audio,video{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent;}
  56. body{line-height:1;}
  57. article,aside,details,figcaption,figure,
  58. footer,header,hgroup,menu,nav,section{display:block;}
  59. nav ul{list-style:none;}
  60. blockquote,q{quotes:none;}
  61. blockquote:before,blockquote:after,
  62. q:before,q:after{content:'';content:none;}
  63. a{margin:0;padding:0;font-size:100%;vertical-align:baseline;background:transparent;}
  64. ins{background-color:#ff9;color:#000;text-decoration:none;}
  65. mark{background-color:#ff9;color:#000;font-style:italic;font-weight:bold;}
  66. del{text-decoration:line-through;}
  67. abbr[title],dfn[title]{border-bottom:1px dotted;cursor:help;}
  68. table{border-collapse:collapse;border-spacing:0;}
  69. hr{display:block;height:1px;border:0;border-top:1px solid #cccccc;margin:1em 0;padding:0;}
  70. input,select{vertical-align:middle;}
  71. html{ background: #EDEDED; height: 100%; }
  72. body{background:#FFF;margin:0 auto;min-height:100%;padding:0 30px;width:440px;color:#666;font:14px/23px Arial,Verdana,sans-serif;}
  73. h1,h2,h3,p,ul,ol,form,section{margin:0 0 20px 0;}
  74. h1{color:#333;font-size:20px;}
  75. h2,h3{color:#333;font-size:14px;}
  76. h3{margin:0;font-size:12px;font-weight:bold;}
  77. ul,ol{list-style-position:inside;color:#999;}
  78. ul{list-style-type:square;}
  79. code,kbd{background:#EEE;border:1px solid #DDD;border:1px solid #DDD;border-radius:4px;-moz-border-radius:4px;-webkit-border-radius:4px;padding:0 4px;color:#666;font-size:12px;}
  80. pre{background:#EEE;border:1px solid #DDD;border-radius:4px;-moz-border-radius:4px;-webkit-border-radius:4px;padding:5px 10px;color:#666;font-size:12px;}
  81. pre code{background:transparent;border:none;padding:0;}
  82. a{color:#70a23e;}
  83. header{padding: 30px 0;text-align:center;}
  84. </style>
  85. </head>
  86. <body>
  87. <header>
  88. <a href="http://www.slimframework.com"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHIAAAA6CAYAAAB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a/XQYEFSaagWwbgjNA+ywstLpEWTKgc5gwVpsyO1bTII+tA6B7BPS+0PiznuM9gPKsPVXbFdADMtwbJxSmkXWfRh6AZhyyzBjIHoDmnCGaMZAKjd5hyNJYCBGDOVcg28AXQ5atAVDO3c4dSALQnYblfa3M4kc/cyA7gMIUBQCTyl4kugIpy8yA7ACqK8Uwk30lIFGOEV3rPDAELwQkr/9YjkaCPDQhCcsrAYlF1v8W8jAEYeQDY7qn6tNGWudfq+YUEr6uq6FZzBpJMUfWFDatLHMCciw2mRC+k81qCCA1DzK4aUVfrJpxnloZWCPVnOgYy8L3GvKjE96HpweQoy7iwVQclVutLOEKJxA8gaRCjSzgNI2zhh3bQhzBCQQPIHGaHaUd96GJbZz3Smmjy16u6j3FuKyNxcBarxqWWfYFE0tVVO1Rl3t1Mb05V00MQCJ71YHpNaMcsjWAfkQvPPkaNC7LqTG7JAhGXTKYf+VDeXAX9IvURoAwtTFHvyYIxtnd5tPkywrPafcwbeSuGVwFau3b76NO7SHQrvqhfFE8kM0Wvpv8gVYiYBlxL+fW/34bgP6bIC7JR7YPDubcHCPzIp4+cum7U6NlhZgK7lua3KGLeFwE2m+HblDYWSHG2SAfINuwBBfxbJEIuWZbBH4fAExD7cvaGVyXyH0dhiAYc92z3ZDfUVv+jgb8HrHy7WVO/8BFcy9vuTz+nwADAGnOR39Yg/QkAAAAAElFTkSuQmCC" alt="Slim"/></a>
  89. </header>
  90. <h1>Welcome to Slim!</h1>
  91. <p>
  92. Congratulations! Your Slim application is running. If this is
  93. your first time using Slim, start with this <a href="http://www.slimframework.com/learn" target="_blank">"Hello World" Tutorial</a>.
  94. </p>
  95. <section>
  96. <h2>Get Started</h2>
  97. <ol>
  98. <li>The application code is in <code>index.php</code></li>
  99. <li>Read the <a href="http://www.slimframework.com/documentation/stable" target="_blank">online documentation</a></li>
  100. <li>Follow <a href="http://www.twitter.com/slimphp" target="_blank">@slimphp</a> on Twitter</li>
  101. </ol>
  102. </section>
  103. <section>
  104. <h2>Slim Framework Community</h2>
  105. <h3>Support Forum and Knowledge Base</h3>
  106. <p>
  107. Visit the <a href="http://help.slimframework.com" target="_blank">Slim support forum and knowledge base</a>
  108. to read announcements, chat with fellow Slim users, ask questions, help others, or show off your cool
  109. Slim Framework apps.
  110. </p>
  111. <h3>Twitter</h3>
  112. <p>
  113. Follow <a href="http://www.twitter.com/slimphp" target="_blank">@slimphp</a> on Twitter to receive the very latest news
  114. and updates about the framework.
  115. </p>
  116. <h3>IRC</h3>
  117. <p>
  118. Find Josh Lockhart in the irc.freenode.net "##slim" IRC channel during the day. Say hi, ask questions,
  119. or just hang out with fellow Slim users.
  120. </p>
  121. </section>
  122. <section style="padding-bottom: 20px">
  123. <h2>Slim Framework Extras</h2>
  124. <p>
  125. Custom View classes for Smarty, Twig, Mustache, and other template
  126. frameworks are available online in a separate repository.
  127. </p>
  128. <p><a href="https://github.com/codeguy/Slim-Extras" target="_blank">Browse the Extras Repository</a></p>
  129. </section>
  130. </body>
  131. </html>
  132. EOT;
  133. echo $template;
  134. });
  135. //POST route
  136. $app->post('/post', function () {
  137. echo 'This is a POST route';
  138. });
  139. //PUT route
  140. $app->put('/put', function () {
  141. echo 'This is a PUT route';
  142. });
  143. //DELETE route
  144. $app->delete('/delete', function () {
  145. echo 'This is a DELETE route';
  146. });
  147. /**
  148. * Step 4: Run the Slim application
  149. *
  150. * This method should be called last. This is responsible for executing
  151. * the Slim application using the settings and routes defined above.
  152. */
  153. $app->run();