mafonso/duality-demo

This package is abandoned and no longer maintained. The author suggests using the taviroquai/duality-demo package instead.
There is no license information available for the latest version (v1.0.0) of this package.

Project for Duality PHP Framework

Installs: 12

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Language:JavaScript

v1.0.0 2014-12-07 21:11 UTC

This package is auto-updated.

Last update: 2022-02-01 12:39:21 UTC


README

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();