ReadyDev
... LoadModule vhost_alias_module modules/mod_vhost_alias.so ... Include conf/extra/httpd-vhosts.conf ...
... Listen 0.0.0.0:8000 Listen [::0]:8000 ...
...
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
...
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
......
<VirtualHost *:8000>
ServerName readycms.com
ServerAlias www.readycms.com
ServerAdmin readyteam@readycms.com
DocumentRoot "C:/.../readycms/"
...
<Directory "C:/.../readycms/">
Options All
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
</VirtualHost>
...WampServer > Clic droit > Redémarrer les services
<?php echo "Démarrage de l'application...";
http://localhost:8000/ ... La page web s'affiche avec le message à l'écran
"C:\wamp64\bin\apache\apache2.4.54.2\bin\httpd.exe" -t ... AH00526: Syntax error on line 38 of C:/wamp64/bin/apache/apache2.4.54.2/conf/extra/httpd-vhosts.conf: DocumentRoot must be a directory ... La ligne (38) du fichier (httpd-vhosts.conf) est en erreur
"C:\wamp64\bin\apache\apache2.4.54.2\bin\httpd.exe" -t ... Syntax OK
<?php require $_SERVER["DOCUMENT_ROOT"] . "/php/class/GInclude.php"; ... use php\class\GProcess; ... $lProcess = new GProcess(); ...
<?php
...
namespace php\class;
...
class GProcess
{
public function __construct()
{
echo "Démarrage de l'application...";
}
}<?php require $_SERVER["DOCUMENT_ROOT"] . "/php/class/GAutoload.php"; ...
<?php
function GAutoloadRegister($_className)
{
$lFilename = $_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . $_className . ".php";
$lFilename = str_replace("\\", "/", $lFilename);
if (is_readable($lFilename)) {
require $lFilename;
}
}
...
if (version_compare(PHP_VERSION, "5.1.2", ">=")) {
if (version_compare(PHP_VERSION, "5.3.0", ">=")) {
spl_autoload_register("GAutoloadRegister", true, true);
} else {
spl_autoload_register("GAutoloadRegister");
}
} else {
function spl_autoload_register($_className)
{
GAutoloadRegister($_className);
}
}http://localhost:8000/ ... La page web s'affiche avec le message à l'écran
WampServer > PHP > Extensions PHP > xdebug
Ouvrir l'interface (Xdebug Wizard) en suivant le lien ci-dessous https://xdebug.org/wizard
"C:\wamp64\bin\php\php8.2.0\php.exe" -i > tmp\phpinfo.txt
Copier le contenu du fichier > tmp\phpinfo.txt
Coller dans l'interface (Xdebug Wizard) Cliquer sur le bouton > Analyze my phpinfo() output ... Télécharger le fichier DLL > php_xdebug-3.3.2-8.3-vs16-x86_64.dll
Copier le fichier > php_xdebug-3.3.2-8.3-vs16-x86_64.dll Coller dans le dossier > C:\wamp64\bin\php\php8.2.0\zend_ext
... [xdebug] zend_extension="C:\wamp64\bin\php\php8.2.0\zend_ext\php_xdebug-3.3.2-8.2-vs16-x86_64.dll" xdebug.mode=debug,develop ...
WampServer > Redémarrer les services
VSCode > Extensions > PHP Debug (Xdebug) > Install
VSCode > Debug > create a launch.json file > PHP
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003
}
]
}VSCode > Placer les points d'arrêts aux lignes souhaitées
VSCode > Debug > Run and Debug > Listen for Xdebug > Run
http://localhost:8000 ... Le code se bloque sur le premier point d'arrêt dans VSCode
VSCode > Accéder à la session de débogage
VSCode > Naviguer dans une fonction
VSCode > Naviguer dans une fonction VSCode > Visualiser les variables locales
VSCode > Naviguer dans une fonction VSCode > Visualiser la pile des appels
<?php ... $lProcess = new GProcess(); $lProcess->init(); $lProcess->run(); $lProcess->runFooter(); ...
<?php
...
class GProcess
{
public function __construct() {}
...
public function init()
{
$this->toHeader();
}
...
public function run()
{
echo sprintf("Démarrage de l'application...\n");
}
...
public function runFooter()
{
echo sprintf("</div>\n");
echo sprintf("</body>\n");
echo sprintf("</html>\n");
}
...
private function toHeader()
{
echo sprintf("<!DOCTYPE html>\n");
echo sprintf("<html lang='fr'>\n");
echo sprintf("<head>\n");
echo sprintf("<title>%s</title>\n", $this->toTitle());
echo sprintf("<meta charset='UTF-8'/>\n");
echo sprintf("<link rel='shortcut icon' type='image/png'
href='%s'/>\n", $this->toLogo());
echo sprintf("<meta name='viewport' content='width=device-width,
maximum-scale=1.0, minimum-scale=1.0, initial-scale=1.0, user-
scalable=no'/>\n");
echo sprintf("</head>\n");
echo sprintf("<body>\n");
echo sprintf("<div>\n");
}
...
private function toTitle()
{
$lTitle = $this->toSiteName();
return $lTitle;
}
...
private function toSiteName()
{
return "ReadyCms";
}
...
private function toLogo()
{
return "/data/img/app-logo.png";
}
...
}Ajouter le fichier > data/img/app-logo.png
http://localhost:8000/ ... La page web s'affiche avec le message à l'écran ... Le logo de la page web apparaît
Page Web > Clic droit > Afficher le code source de la page ... Ou utiliser le raccourci clavier > Ctrl + U ... Le code source de la page s'affiche
<?php
...
class GProcess
{
...
public function runFooter()
{
echo sprintf("</div>\n");
echo sprintf("</div>\n");
...
echo sprintf("</body>\n");
echo sprintf("</html>\n");
}
...
private function toHeader()
{
echo sprintf("<!DOCTYPE html>\n");
echo sprintf("<html lang='fr'>\n");
echo sprintf("<head>\n");
...
$this->toStyleCss();
...
echo sprintf("</head>\n");
echo sprintf("<body>\n");
...
echo sprintf("<div class='Html1'>\n");
echo sprintf("<div class='Html2>\n");
}
...
private function toStyleCss()
{
echo sprintf("<link rel='stylesheet' href='/css/styles.css'/>\n");
}
}
...* {
color: white;
margin: 0;
padding: 0;
box-sizing: border-box;
}
...
body {
background-color: #051039;
font-family: arial;
font-size: 16px;
text-align: center;
}
...
html {
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: transparent;
overflow: auto;
scrollbar-color: #5f6681 #051039;
scrollbar-width: auto;
}
...
.Html1 {
border: 1px solid transparent;
position: relative;
}
...
.Html2 {
background-color: #253059;
max-width: 1000px;
margin: auto;
margin-top: 250px;
margin-bottom: 250px;
min-height: 150px;
...
border: 10px solid transparent;
border-image: url("/data/img/app-border.png") 30 round;
-webkit-border-image: url("/data/img/app-border.png") 30 round;
-moz-border-image: url("/data/img/app-border.png") 30 round;
-o-border-image: url("/data/img/app-border.png") 30 round;
}
...Ajouter le fichier > data/img/app-border.png
http://localhost:8000/ ... La page web s'affiche avec le message à l'écran ... La mise en forme de la page web apparaît ... La bordure du contenu central la page web apparaît
<?php
...
class GProcess
{
...
private function toHeader()
{
echo sprintf("<!DOCTYPE html>\n");
echo sprintf("<html lang='fr'>\n");
echo sprintf("<head>\n");
...
echo sprintf("</head>\n");
echo sprintf("<body>\n");
echo sprintf("<div class='Html1'>\n");
...
echo sprintf("<div class='Background1'></div>\n");
echo sprintf("<div class='Background2'></div>\n");
echo sprintf("<div class='Background3'></div>\n");
...
echo sprintf("<div class='Html2 HtmlPage'>\n");
}
...
}
......
.Background1 {
position: absolute;
top: 0px;
left: 0px;
right: 0px;
min-height: 300px;
z-index: -1;
...
background-image: url("/data/img/app-bg-top-paris-2024.gif"),
url("/data/img/app-bg-top-fond.jpg");
background-position: center top, left top;
background-repeat: no-repeat, no-repeat;
background-size: auto 85%, 100% 100%;
...
border: 10px solid transparent;
border-image: url("/data/img/app-border.png") 30 round;
-webkit-border-image: url("/data/img/app-border.png") 30 round;
-moz-border-image: url("/data/img/app-border.png") 30 round;
-o-border-image: url("/data/img/app-border.png") 30 round;
}
...
.Background2 {
position: absolute;
top: 300px;
bottom: 300px;
left: 0px;
right: 0px;
z-index: -1;
...
background-image: url("/data/img/app-bg-middle.gif");
background-position: center center;
background-repeat: repeat;
background-size: auto;
}
...
.Background3 {
position: absolute;
bottom: 0px;
left: 0px;
right: 0px;
min-height: 300px;
z-index: -1;
...
background-image: url("/data/img/app-bg-footer.jpg");
background-position: left top;
background-repeat: no-repeat;
background-size: 100% 100%;
...
border: 10px solid transparent;
border-image: url("/data/img/app-border.png") 30 round;
-webkit-border-image: url("/data/img/app-border.png") 30 round;
-moz-border-image: url("/data/img/app-border.png") 30 round;
-o-border-image: url("/data/img/app-border.png") 30 round;
}
...Ajouter le fichier > data/img/app-bg-top-fond.jpg Ajouter le fichier > data/img/app-bg-top-paris-2024.gif Ajouter le fichier > data/img/app-bg-middle.gif Ajouter le fichier > data/img/app-bg-footer.jpg
http://localhost:8000/ ... La page web s'affiche avec le message à l'écran ... La mise en forme de la page web apparaît ... La bordure du contenu central la page web apparaît
...
<VirtualHost *:8000>
ServerName readycms.com
ServerAlias www.readycms.com
ServerAdmin readyteam@readycms.com
DocumentRoot "C:/dev/pratique/rdv-systeme-gestion-contenu-web/v01/"
...
SetEnv ENV_TYPE "TEST"
...
<Directory "C:/dev/pratique/rdv-systeme-gestion-contenu-web/v01/">
Options All
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
</VirtualHost>
...<?php
...
class GProcess
{
...
public function run()
{
if ($this->isTestEnv()) {
echo sprintf("Démarrage de l'application (TEST)...\n");
} else {
echo sprintf("Démarrage de l'application (PROD)...\n");
}
}
...
private function isTestEnv()
{
$lEnv = GEnv::Instance();
return ($lEnv->m_envType == "TEST");
}
...
private function loadEnv($_env, $_defaultValue = "")
{
$lEnv = getenv($_env);
return $lEnv ? $lEnv : $_defaultValue;
}
...
}
...WampServer > Redémarrer les services
http://localhost:8000/ ... La variable d'environnement (ENV_TYPE) est bien lue. Elle contient la valeur (TEST) ... La page web s'affiche avec le bon message à l'écran
https://fonts.google.com/specimen/Akronim ... Get Font > Download all (1)
Décompresser le fichier > Akronim.zip ... Copier le fichier > Akronim-Regular.ttf Coller dans le dossier > libs\google-fonts\Akronim\
<?php
...
class GProcess
{
...
public function run()
{
$lKernel = new GKernel();
$lKernel->run();
}
...
private function toHeader()
{
echo sprintf("<!DOCTYPE html>\n");
echo sprintf("<html lang='fr'>\n");
echo sprintf("<head>\n");
...
$this->toStyleCss();
...
echo sprintf("</head>\n");
echo sprintf("<body>\n");
...
}
...
private function toStyleCss()
{
...
echo sprintf("<link rel='stylesheet' href='/libs/google-fonts/Akronim/css.css'/>\n");
...
}
...
}<?php
...
namespace php\class;
...
class GKernel
{
public function __construct() {}
...
public function run()
{
$this->toMenu();
}
...
private function toMenu()
{
echo sprintf("<div class='Menu1'>\n");
echo sprintf("<span class='Menu5'>%s</span>\n", $this-
>toSiteName());
echo sprintf("</div>\n");
}
...
private function toSiteName()
{
return "ReadyCms";
}
...
}@font-face {
font-family: "Akronim";
font-style: normal;
src: url("Akronim-Regular.ttf");
}...
.Menu1 {
background-color: rgba(255, 255, 255, 0.2);
text-align: left;
font-size: 0px;
position: relative;
line-height: 45px;
}
...
.Menu5 {
display: inline-block;
vertical-align: middle;
color: cyan;
font-size: 25px;
font-family: Akronim;
color: cyan;
}
...http://localhost:8000/ ... La police personnalisée Google Fonts est bien intégrée ... La page web s'affiche avec le bon style de famille
https://fontawesome.com/v4/ ... Get Started > No thanks, I'll stick with Font Awesome 4 Download > No thanks, I'll stick with Font Awesome 4
Décompresser le fichier > font-awesome-4.7.0.zip ... Copier le fichier > font-awesome.min.css Coller dans le dossier > libs\font-awesome\css\ ... Copier le fichier > fontawesome-webfont.woff2 Coller dans le dossier > libs\font-awesome\fonts\
<?php
...
class GProcess
{
...
public function run()
{
$lKernel = new GKernel();
$lKernel->run();
}
...
private function toHeader()
{
echo sprintf("<!DOCTYPE html>\n");
echo sprintf("<html lang='fr'>\n");
echo sprintf("<head>\n");
...
$this->toStyleCss();
...
echo sprintf("</head>\n");
echo sprintf("<body>\n");
...
}
...
private function toStyleCss()
{
...
echo sprintf("<link rel='stylesheet' href='/libs/font-awesome/css/font-awesome.min.css'/>\n");
...
}
...
}<?php
...
namespace php\class;
...
class GKernel
{
public function __construct() {}
...
public function run()
{
$this->toMenu();
}
...
private function toMenu()
{
echo sprintf("<div class='Menu1'>\n");
echo sprintf("<span class='Menu5'>%s</span>\n", $this-
>toSiteName());
...
echo sprintf("<div class='Bars1'><i class='fa fa-bars'></i></div>\n");
...
echo sprintf("</div>\n");
}
...
}...
.Bars1 {
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
font-size: 25px;
font-family: Akronim;
color: white;
padding: 0 10px 0 10px;
display: inline-block;
vertical-align: middle;
position: absolute;
top: 0px;
right: 0px;
cursor: pointer;
}
...http://localhost:8000/ ... L'icône Font Awesome est bien intégrée ... La page web s'affiche avec l'icône Font Awesome
<?php
...
class GProcess
{
...
public function runFooter()
{
echo sprintf("</div>\n");
echo sprintf("</div>\n");
...
$this->toScriptJs();
...
echo sprintf("</body>\n");
echo sprintf("</html>\n");
}
...
public function toScriptJs()
{
echo sprintf("<script src='/js/scripts.js'></script>\n");
}
...
}
...<?php
...
class GKernel
{
...
private function toMenu()
{
echo sprintf("<div class='Menu1'>\n");
...
echo sprintf("<div class='Bars1' onclick='call_server(\"app\", \"open_menu_bars\", this)'><i class='fa fa-bars'></i></div>\n");
...
echo sprintf("</div>\n");
}
...
}
...function call_server(_module, _method, _obj = null, _data = null) {
console.log("Intégration JavaScript dans l'application...");
}http://localhost:8000/ ... La page web s'affiche ... Ouvrir la consolde de débogage ... Ctrl + Shift + I > Console ... Se rendre sur la page Appuyer sur l'icône de la barre de menu ... Le message JavaScript apparaît dans la console de débogage
WampServer > Apache > Modules Apache > rewrite_module
VSCode > Extensions > Apache Conf > Install
DirectoryIndex index.php
...
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /?pageId=$1 [L,QSA]
</IfModule><?php
...
class GKernel
{
...
public function run()
{
$this->toMenu();
$this->toPage();
}
...
private function toPage()
{
var_dump($_GET);
}
...
}http://localhost:8000/home/admin/ ... La page web s'affiche ... La variable ($_GET) contient le paramètre (pageId) Le paramètre (pageId) possède la valeur (home/admin/)
<?php
...
class GKernel
{
...
private function toPage()
{
$lPageId = $this->getPageId();
echo sprintf("Appel de la page (%s)...", $lPageId);
}
...
private function getPageId()
{
$lPageId = $this->loadGET("pageId");
if ($lPageId != "") {
if (substr($lPageId, -1) == "/") {
$lPageId = substr($lPageId, 0, -1);
}
}
$lPageId = sprintf("/%s", $lPageId);
return $lPageId;
}
...
private function loadGET($_key, $_defaultValue = "")
{
if (!isset($_GET[$_key])) return $_defaultValue;
return $_GET[$_key];
}
...
}http://localhost:8000/home/admin/ ... La page web s'affiche ... L'identifiant de la page est bien récupérée (/home/admin)
<?php
...
class GKernel
{
...
private function toPage()
{
$lPageId = $this->getPageId();
...
if ($lPageId == "/home/admin") {
$this->toAdmin();
} else {
$this->toError();
}
}
...
private function toAdmin()
{
$lAdmin = new GAdmin();
$lAdmin->run();
}
...
private function toError()
{
echo sprintf("Page non trouvée...");
}
...
}
...<?php
...
namespace php\class;
...
class GAdmin
{
public function __construct() {}
...
public function run()
{
echo sprintf("Page d'administration...");
}
}http://localhost:8000/home/admin/ ... La page web s'affiche et pointe sur la page d'administration ... http://localhost:8000/ ... La page web s'affiche et présente le message (Page non trouvée...)