Aller à : navigation, rechercher

Maarch Courrier/1.5/fr/Install/DeveloperHandbook

Maarch Developer handbook

Retrieve MaarchCourrier

Ubuntu is Highly Recommended !

cd /var/www/html/
mkdir MaarchCourrier
cd MaarchCourrier
git clone .
git config core.fileMode false

Install Maarch from :

Install composer from :

mv composer.phar /usr/local/bin/composer

Install slimFramework from (Optionnal, already downloaded during installation)

cd /var/www/html/MaarchCourrier
composer require slim/slim
composer dump-autoload
Install respect/validation
cd /var/www/html/MaarchCourrier
composer require respect/validation

Tuto slim framework 3 :


Install npm from (Optionnal, already downloaded during installation)

sudo apt-get install nodejs
sudo apt-get install npm
sudo npm install npm@latest -g
cd /var/www/html/MaarchCourrier
npm install --production

Tuto angular 2 :

Creates a vhost on apache

sudo nano /etc/apache2/sites-available/MaarchCourrier.conf
listen 8090
<VirtualHost *:8090>
        DocumentRoot "/var/www/html/MaarchCourrier"
        ServerName maarchcourrier
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

       Options -Indexes
       Options FollowSymLinks Includes ExecCGI
       <FilesMatch ".*">
        Order deny,allow
        Deny from all
       # Root to allow index.php
       <FilesMatch "^$">
        Order allow,deny
         Allow from all
       # Core root
       <FilesMatch "^(index|ws_server|static|merged_js|merged_css|reopen|applet_launcher|applet_controller|log)\.php$">
        Order allow,deny
        Allow from all
       # App static files
       <FilesMatch "\.(css|js|jpg|jpeg|png|gif|ttf|woff|woff2)$">
        Order allow,deny
        Allow from all
       # App tools files
       <FilesMatch "\.(htm|html|jar|jnlp)$">
        Order allow,deny
        Allow from all

A partir de Apache 2.4, il faut éditer le fichier /etc/apache2/apache2.conf, et modifier cette partie comme ceci :
<Directory /var/www/html>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
sudo a2enmod rewrite
sudo a2ensite MaarchCourrier.conf

Create your own develop branch

Lorsque l’on commence un développement, on créé sa branche à partir de la branche develop. Une branche personnelle est donc créée à chaque fois que l’on souhaite faire une correction ou une évolution de code. Elle devra être fusionnée avec la branche develop une fois que les développements ont été testés unitairement et fonctionnellement.

1. checkout de la branche develop

git checkout -b develop origin/develop

2. création de la branche locale personnelle à partir de la branche develop

git branch lgi-feat-admin-status develop

3. basculement sur la branche personnelle

git checkout lgi-feat-admin-status

Merge develop in your personal branch

Merge de la branche develop vers sa branche personnelle

1. Se positionner sur la branche develop et la mettre à jour

git checkout develop
git pull

2. On revient sur sa branche personnelle

git checkout lgi-feat-admin-status

3. On merge la branche develop vers sa branche personnelle

git merge develop

-> read

Commit your development on develop branch

#on your local branch you have to commit
git commit -m "[MESSAGE]"

git checkout develop
git pull
git checkout lgi-feat-admin-status

git merge develop
# You may need to resolve conflict

git checkout develop
git pull --rebase
git merge lgi-feat-admin-status
git rebase -i
git push

To jump from a tag to another tag

git checkout tags/17.06.5 -b 17.06.5

To delete a local tag

git tag -d 17.06-RC.5

To update local repository (when remote branch was deleted)

git fetch -p

Files header


* Copyright Maarch since 2008 under licence GPLv3.
* See LICENCE.txt file at the root folder for more details.
* This file is part of Maarch software.

Coding standards


Coding style guide


Documentation style guide

use phpdoc -> gives samples

Tests your REST webservices

UML specifications



Writes the test first : Sample of testing a controller

require_once __DIR__.'/define.php';

class StatusControllerTest extends PHPUnit_Framework_TestCase
    public function testGetList()
        $action = new \Core\Controllers\StatusController();
        $environment = \Slim\Http\Environment::mock(
                'REQUEST_METHOD' => 'GET',
        $request = \Slim\Http\Request::createFromEnvironment($environment);
        $response = new \Slim\Http\Response();
        $response = $action->getList($request, $response, []);


command to test with phpunit :

cd /var/www/html/MaarchCourrier
phpunit --coverage-html /tmp/tests --whitelist core/Test/


Pour les utilisateurs Linux, il est possible de personnaliser votre console avec le nom de la branche courante en entête. Pour ce faire : Ouvrir le fichier ~/.bashrc Ajoutez les lignes suivantes :

function parse_git_branch {
    git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1]/"

GREEN=$(tput setaf 2) 
DEFAULT=$(tput sgr0)

NPM : How to install a new plugin

First of all, NPM is working with a package.json file which reference every plugin installed on MaarchCourrier.

If you want to install/add a new package to the application, you should pass by this file, every decent package should normally be present on NPM.

Check the NPM webpage associated with your package and you should see a npm command like “npm install jquery” for the jquery plugin, add it “--save” to save/write the package in the package.json file automatically, e.g “npm install jquery --save”.

Launch the command in a terminal at the application root and you should see NPM working.

Your package is going to be installed in the node_modules folder (located at the application root).

Once your package is downloaded, you got to load it in the application, to do so, open the merged_jsAbstract file and add the path line corresponding to your minify js file package e.g readfile('node_modules/jquery/dist/jquery.min.js');

Your package is now loaded in the application ;)

Angular in MaarchCourrier

There is 2 modes for Angular in our application, a Production Mode and a Developer Mode. The Production Mode consists on a only bundled file regrouping all angular files (which is faster).

Production Mode is set by default in our application, to change it, you have to set the PROD_MODE variable in apps/maarch_entreprise/define.php to false.

When Production Mode is false, the application will load each angular file one by one (which is slower).

Angular (2) is working with TypeScript files (.ts). TypeScript describe itself as “a typed superset of JavaScript that compiles to JavaScript”, so when you are developing with Angular and with TypeScript files, you should launch this command into a terminal “npm run build:watch”.

This command will watch your TypeScript files and transpile them into JavaScript files every time you save them. Finally, when you have finished your developments, don’t forget to rebuild the bundled file used in Production Mode, to do so, launch this command into a terminal “npm run build-prod”.

To know commits between 2 tags

git log --pretty=oneline 17.06.1..17.06.2