Criar a pasta /var/www/html/app-mvc/src/config
E dentro dela criar o arquivo config.php, contendo o código abaixo:
<?php
declare(strict_types = 1);
/**
* Configuration
*
* For more info about constants please @see http://php.net/manual/en/function.define.php
*/
/**
* Configuration for: Error reporting
* Useful to show every little problem during development, but only show hard errors in production
*/
define('ENVIRONMENT', 'development');
if (ENVIRONMENT == 'development' || ENVIRONMENT == 'dev') {
error_reporting(E_ALL);
ini_set("display_errors", "1");
}
/**
* Configuration for: URL
* Here we auto-detect your applications URL and the potential sub-folder. Works perfectly on most servers and in local
* development environments (like WAMP, MAMP, etc.). Don't touch this unless you know what you do.
*
* URL_PUBLIC_FOLDER:
* The folder that is visible to public, users will only have access to that folder so nobody can have a look into
* "/application" or other folder inside your application or call any other .php file than index.php inside "/public".
*
* URL_PROTOCOL:
* The protocol. Don't change unless you know exactly what you do. This defines the protocol part of the URL, in older
* versions of MINI it was 'http://' for normal HTTP and 'https://' if you have a HTTPS site for sure. Now the
* protocol-independent '//' is used, which auto-recognized the protocol.
*
* URL_DOMAIN:
* The domain. Don't change unless you know exactly what you do.
* If your project runs with http and https, change to '//'
*
* URL_SUB_FOLDER:
* The sub-folder. Leave it like it is, even if you don't use a sub-folder (then this will be just "/").
*
* URL:
* The final, auto-detected URL (build via the segments above). If you don't want to use auto-detection,
* then replace this line with full URL (and sub-folder) and a trailing slash.
*/
define('URL_PUBLIC_FOLDER', 'public');
define('URL_PROTOCOL', '//');
define('URL_DOMAIN', $_SERVER['HTTP_HOST']);
define('URL_SUB_FOLDER', str_replace(URL_PUBLIC_FOLDER, '', dirname($_SERVER['SCRIPT_NAME'])));
define('URL', URL_PROTOCOL . URL_DOMAIN . URL_SUB_FOLDER);
define('APP_TITTLE', 'Aplication Title');
/**
* Configuration for: Database
* This is the place where you define your database credentials, database type etc.
*/
define('DB_TYPE', 'mysql'); // mysql or pgsql
define('DB_HOST', '127.0.0.1');
define('DB_NAME', 'app-mvc');
define('DB_USER', 'root');
define('DB_PASS', '');
define('DB_PORT', '3306');// 3306 or 5432
define('DB_CHARSET', 'utf8mb4');
Veja que podemos mudar o nome da pasta de entrada para outro nome diferente de public.
Também temos opção para ambientes entre outras.
Como ainda não criamos os .htaccess, precisamos digitar /public ao final, mas depois não mais será necessário
http://localhost/app-mvc/public
Agora ele reclama a falta da classe Mvc\Core\Router
Agora, como criamos o config.php e ativamos o Whoops para tratar os erros, já recebemos os detalhes através dele.
Agora iremos criar o Router.php