Skip to content

Commit

Permalink
docs project conf
Browse files Browse the repository at this point in the history
  • Loading branch information
jcheron committed Apr 16, 2017
1 parent ffd27f5 commit 30f43ff
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
78 changes: 78 additions & 0 deletions docs/confproject.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
Project configuration
=====================
Normally, the installer limits the modifications to be performed in the configuration files :

Main configuration
------------------
The main configuration of a project is localised in the ``app/conf/config.php`` file.
::
<?php
return array(
"siteUrl"=>"%siteUrl%",
"database"=>[
"dbName"=>"%dbName%",
"serverName"=>"%serverName%",
"port"=>"%port%",
"user"=>"%user%",
"password"=>"%password%"
],
"sessionToken"=>"%temporaryToken%",
"namespaces"=>[],
"templateEngine"=>'micro\views\engine\Twig',
"templateEngineOptions"=>array("cache"=>false),
"test"=>false,
"debug"=>false,
"di"=>[%injections%],
"cacheDirectory"=>"cache/",
"mvcNS"=>["models"=>"models","controllers"=>"controllers"]
);

Services configuration
----------------------
Services loaded on startup are configured in the ``app/conf/services.php`` file.
::
<?php
use micro\cache\CacheManager;
use micro\controllers\Router;
use micro\orm\DAO;
/*if($config["test"]){
\micro\log\Logger::init();
$config["siteUrl"]="http://127.0.0.1:8090/";
}*/
$db=$config["database"];
if($db["dbName"]!==""){
DAO::connect($db["dbName"],@$db["serverName"],@$db["port"],@$db["user"],@$db["password"]);
}
CacheManager::startProd($config);
Router::start();
Router::addRoute("_default", "controllers\Main");

Pretty URLs
-----------
Apache
^^^^^^
The framework ships with an **.htaccess** file that is used to allow URLs without index.php. If you use Apache to serve your Micro application, be sure to enable the **mod_rewrite** module.

If the .htaccess file that ships with Laravel does not work with your Apache installation, try this one:

::
AddDefaultCharset UTF-8

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_ACCEPT} !(.*images.*)
RewriteRule ^(.*)$ index.php?c=$1 [L,QSA]
</IfModule>

Nginx
^^^^^
On Nginx, the following directive in your site configuration will allow "pretty" URLs:

location / {
try_files $uri $uri/ /index.php?c=$query_string;
}
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Installation
------------
* :doc:`install`
* :doc:`createproject`
* :doc:`confproject`


Indices and tables
Expand Down
1 change: 1 addition & 0 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ For instance, ``Micro new blog`` would create a directory named **blog** contain
::
Micro new blog

You can see more options about installation by reading the :doc:`createproject` section.

0 comments on commit 30f43ff

Please sign in to comment.