PHP Classes

File: src/routes.php

Recommend this page to a friend!
  Classes of Pierre-Henry Soria   GetMeALatte   src/routes.php   Download  
File: src/routes.php
Role: Example script
Content type: text/plain
Description: Example script
Class: GetMeALatte
Promote a product to be sold to a crowd
Author: By
Last change:
Date: 1 year ago
Size: 1,201 bytes
 

Contents

Class file image Download
<?php
/**
 * @author Pierre-Henry Soria <hi@ph7.me>
 * @license MIT License; <https://opensource.org/licenses/MIT>
 */

namespace GetMeALatteLike;

use
GetMeALatteLike\Kernel\Http\Router;
use
GetMeALatteLike\Kernel\PhpTemplate\ViewNotFound;
use
GetMeALatteLike\Kernel\Session;
use
GetMeALatteLike\Service\UserSession as UserSessionService;
use
Exception;

$userSession = new UserSessionService(new Session());

try {
   
Router::get('/', 'Homepage@index');
   
Router::get('/about', 'Homepage@about');
   
Router::getAndPost('/contact', 'Homepage@contact');

    if (!
$userSession->isLoggedIn()) {
       
Router::getAndPost('/signup', 'Account@signUp');
       
Router::getAndPost('/signin', 'Account@signIn');
    }

    if (
$userSession->isLoggedIn()) {
       
Router::getAndPost('/account/edit', 'Account@edit');
       
Router::getAndPost('/account/password', 'Account@password');
       
Router::getAndPost('/payment', 'Payment@payment');
       
Router::getAndPost('/item', 'Payment@item');
       
Router::get('/showitem', 'Payment@showItem');
       
Router::get('/account/logout', 'Account@logout');
    }

   
Router::end();
} catch (
Exception $err ) {
    echo
$err->getMessage();
}