1.1.4 2017-12-11 17:11 UTC

This package is not auto-updated.

Last update: 2024-11-10 05:24:44 UTC


README

Build Status Coverage Status Scrutinizer Code Quality Latest Stable Version License

Example index.php

<?php

require __DIR__ . '/../../vendor/autoload.php';

defined('ENV')
or define('ENV', in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'], false) ? 'dev' : 'prod');

$config = require __DIR__ . '/../../admin/config/config.php';
$application = new \WebComplete\mvc\Application($config);
$front = $application->getContainer()->get(\WebComplete\mvc\front\FrontController::class);
$front->dispatch()->send();

Example config.php

<?php

return [
    'aliases' => [
        '@app' => \dirname(__DIR__ . '/../app'),
        '@web' => \dirname(__DIR__ . '/../web'),
    ],
    'routes' => [
        ['GET', '/post/list', [\app\controllers\PostController::class, 'actionList']],
        ['POST', '/post/update', [\app\controllers\PostController::class, 'actionUpdate']],
    ],
    'cubesLocations' => [
        '@app/cubes',
    ],
    'definitions' => [
        'errorController' => \DI\object(\app\controllers\ErrorController::class),
    ]
];

Example controller.php

<?php

namespace app\controllers;

class SomeController extends AbstractController
{

    protected $layout = '@app/views/layouts/main.php';

    public function index()
    {
        return $this->responseHtml('@app/views/some/index.php', ['name' => 'World']);
    }
}