-
Notifications
You must be signed in to change notification settings - Fork 2
Configuration
Carlos Eduardo edited this page Jun 30, 2016
·
2 revisions
Each application must be in a subdirectory on directory /root/app/
.
Inside of your application folder, create the file config.php
and set the application configurations.
<?php
use \Core\Config;
Config::Set([
'url' => 'http://admin.contoso.com/', // Application URL
'database' => [ // Database Configurations
'driver' => 'mysql', // - Driver (just mysql for now)
'port' => 3306, // - Port (3306 - Default for MySQL)
'host' => 'localhost', // - Databse Host (DNS ou IP)
'schema' => 'test' // - Database Name
'user' => 'root', // - User
'pass' => '', // - Password
'charset' => 'utf8' // - Encoding (optional, utf8 default)
],
'email' => [ // E-mail configurations for class: SendMail extends PHPMailer()
'debug' => FALSE, // - Debug
'smtp' => TRUE, // - SMTP? (TRUE|FALSE)
'auth' => TRUE, // - Auth SMTP? (TRUE|FALSE)
'secure' => 'ssl', // - Crypt (SSL|TLS)
'host' => 'smtp.contoso.com', // - SMTP Host
'port' => 465, // - Port
'user' => '[email protected]', // - User
'pass' => 'drowssap', // - Password
'from' => [ // - From default Address (opcional)
'email'=>'[email protected]', // > E-mail
'name'=>'Contoso :: No Reply' // > Name (optional)
]
],
'authentication' => [ // Auth Configuration
'class' => '\\Authentication\\Authentication', // - Class
'method' => 'validateAccess', // - Method (must be static)
'notcheckon' => [ // - Don't check on this controllers - actions
'auth' => [ // > Controller: Auth
'login', // - Action login
'register' // - Action register
'recoverpass' // - Action recoverpass
],
'error' => '*' // > Controller: Error | Action: Any Action
]
]
]);
If the property authentication
is setted, that will be executed everytime on Controller __construct
.
If the class of authentication
have a static method setController
, the Controller instance will be passed by param, before execute the method.
if (method_exists($auth, 'setController')) {
$app->authentication->class::setController($this);
}
The property notcheckon
it's an array with all controllers that will be ignored on authentication
.
On run application, set the folder name by param where is your application on folder /root/app/
.
<?php
// This file is in /root/public_html/index.php
// Require the loader on folder /root/base/config/loader.php
require_once dirname(__DIR__).'/base/config/loader.php';
// Set as param the folder name of your application
// /root/app/example/
\Core\Application::RUN('example');
// Or if it's no on default directory /root/app/, pass the full path
\Core\Application::RUN(dirname(__DIR__).'/myapp');