PHP code example of m4 / m4mvc

1. Go to this page and download the library: Download m4/m4mvc library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

m4 / m4mvc example snippets




use m4\m4mvc\core\App;
use m4\m4mvc\core\Module;

r\\app\\namespace',
  'modules'   =>  true // if you want co use modules
];

// register modules
Module::register(['web', 'admin']);


$app->paths = [
  'controllers' =>  'app/controllers',
  'app' =>  'app',
  'theme'       =>  [
    'web'   =>  'app/theme/web', // path to public theme
    'admin' =>  'app/theme/admin' // path to admin theme
  ]
];

// db connection
$app->db([
  'DB_HOST'   =>  'localhost',
  'DB_PASSWORD' =>  '',
  'DB_NAME'   =>  'test',
  'DB_USER'   =>  'root'
]);

// run the app
$app->run();