Comment

Comment by Cafesolo

Another nice, little PHP framework is GluePHP (http://gluephp.com).

Hello World using GluePHP:

  <?php
      require_once('glue.php');

      $urls = array(
          '/' => 'index'
      );

      class index {
          function GET() {
              echo "Hello, World!";
          }
      }

      glue::stick($urls);
  ?>
Another example with parameter matching and POST method handling:

  <?php
      require_once('glue.php');

      $urls = array(
          '/' => 'index',
          '/(?P<number>\d+)' => 'index'
      );

      class index {
          function GET($matches) {
              if (array_key_exists('number', $matches)) {
                  echo "The magic number is: " . $matches['number'];
              } else {
                  echo "You did not enter a number.";
              }
          }
          function POST() {
              echo 'The value you entered was ' . $_POST['textbox1'];
          }
      }

      glue::stick($urls);
  ?>
parent Cafesolo 16 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton