2017 © Pedro Peláez
 

library duality-demo

Project for Duality PHP Framework

image

mafonso/duality-demo

Project for Duality PHP Framework

  • Monday, December 8, 2014
  • by taviroquai
  • Repository
  • 0 Watchers
  • 0 Stars
  • 4 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Demo of Duality micro framework

Install

  1. Download zip file and extract to an Apache web directory
  2. Install dependencies with composer: php composer.phar install
  3. Enable mod rewrite on Apache webserver
  4. Edit config/app.php and change your local settings
  5. Open in browser http://localhost/duality-demo/

Minimal API Usage Example

    // Include local configuration
    $config = array(
    'server' => array(
            'url' => '/duality-demo',
            'hostname' => 'localhost'
        )
    );

    // Load dependencies
    require_once './vendor/autoload.php';

    // Create a new application container
    $app = new \Duality\App(dirname(__FILE__), $config);

    // Get server and request
    $server = $app->call('server');
    $request = $server->getRequestFromGlobals($_SERVER, $_REQUEST);

    // Validate HTTP request
    if (!$request) die('HTTP request not found!');

    // Set request
    $server->setRequest($request);

    // Define default route
    $app->call('server')->setHome(function(&$req, &$res) {

        // Tell response what is the output
        $res->setContent('Hello World!');
    });

    // Finaly, tell server to start listening
    $app->call('server')->listen();

The Versions

08/12 2014

dev-master

9999999-dev

Project for Duality PHP Framework

  Sources   Download

MIT

The Requires

 

by Marco Afonso

07/12 2014

v1.0.0

1.0.0.0

  Sources   Download

The Requires

 

by Marco Afonso