Configs - mediahack/mightymouse GitHub Wiki
Configuration files are kept in the app/config
folder. The base MightyMouse (MM) app ships with 3 configs:
The main config file (app/config/main.php
) has your starter app settings. It includes important properties like your session info and app paths. You can edit and add/remove properties to fit your needs. WARNING you can delete the site
and basic name
, company
and description
and the starter JS library references to jquery, but your the following are
###Mandatory Fields:
- root
###Convenience Fields:
- http_protocol
- base_host
- base_url
- clean_url
- index_url
###Extra Fields:
- name
- company
- description
- site
- libs
##Database The database config is very flexible. It ships with 3 different examples for your usage. Because this config is setup as an array (does not have to be this way, it could be an Class like main if you wish) you can make as many different connection properties as you wish. It's up to you on how you access them in your models.
###Usage Here are 2 example config access from a Model Class. ####MySQL
# Config ex
return array(
'default' => array(
'type' => '',
'host' => 'localhost',
'db' => '',
'user' => '',
'pass' => ''
),
'mongodb' => array(
'type' => 'mongodb',
'host' => '127.0.0.1',
'port' => '27017',
'db' => '',
'user' => '',
'pass' => ''
),
'core' => array(
'type' => 'mysql',
'host' => '127.0.0.1',
'db' => 'mydb',
'user' => 'USER',
'pass' => 'PASS'
),
'account' => array(
'type' => 'mysql',
'host' => '127.0.0.1',
'db' => 'accountdb',
'user' => 'USER',
'pass' => 'PASS'
)
);
# Account class
namespace App\Model;
class Account{
private $db;
private $config;
public function __construct($config){
$this->config = $config;
$this->db = new \App\Core\Database($config);
$this->db->connect('account');
}
# CRUD Functions
}
####MongoDB
namespace App\Model;
class User{
private $db;
private $collection;
public function __construct(){
$this->config = new \App\Config\Main;
$this->db = new \App\Core\Database;
$this->db->connect('mongodb');
$this->collection = $this->db->dbh->users;
}
# CRUD functions
}
This file defines your routes. This file is REQUIRED and it MUST have a default route for your app to run. Routes must be an array. You can have up to 2 levels depth in your routes.
Routes are aliases for you Controller and Actions.