-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
125 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
# Managed by Composer | ||
vendor/ | ||
var/ | ||
composer.phar | ||
composer.lock | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,4 @@ | ||
![separe](https://github.com/studoo-app/.github/blob/main/profile/studoo-banner-logo.png) | ||
# edu-framework-skeleton | ||
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/a15f20cbdf2743618efe54e2db39f605)](https://app.codacy.com/gh/studoo-app/edu-framework/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) | ||
[![Latest Stable Version](https://poser.pugx.org/studoo/edu-framework/v)](//packagist.org/packages/studoo/edu-framework) | ||
[![Total Downloads](https://poser.pugx.org/studoo/edu-framework/downloads)](//packagist.org/packages/studoo/edu-framework) | ||
[![Latest Unstable Version](https://poser.pugx.org/studoo/edu-framework/v/unstable)](//packagist.org/packages/edu-framework) | ||
[![License](https://poser.pugx.org/studoo/edu-framework/license)](//packagist.org/packages/studoo/edu-framework) | ||
|
||
Edu-Framework est une proposition d'architecture MVC pour la création de projets ou de travaux pratiques. L'objectif pédagogique est : | ||
- Appréhender un projet par couche via MVC | ||
- Faire un projet "full POO" et dans les "best practices" attendu par les entreprises | ||
- Orchestrer via un gestionnaire de package (composer) | ||
- Développement de test unitaire | ||
- Début d'approche pour l'enseignement d'un framework (Symfony, Laravel ...) | ||
## Bienvenu dans votre projet avec Edu-Framework | ||
|
||
> [!NOTE] | ||
> L'ensemble de la documentation est disponible sur le [https://edu-framework.studoo.app/](https://edu-framework.studoo.app/) | ||
> [!IMPORTANT] | ||
> Ce framework n'est pas adapté à une utilisation en production. Il est destiné à des fins pédagogiques. | ||
> Pour installation et la configuration, voir -> [https://edu-framework.studoo.app/](https://edu-framework.studoo.app/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
version: "3.8" | ||
services: | ||
########################## | ||
# CONTENEURS SERVICES # | ||
########################## | ||
|
||
#Base de données Mysql | ||
database: | ||
container_name: ${APP_NAME}-db | ||
image: mariadb:10.5.8 | ||
restart: always | ||
ports: | ||
- "3306:3306" | ||
volumes: | ||
- ../var/db-data:/var/lib/mysql | ||
environment: | ||
#MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' | ||
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD} | ||
MYSQL_DATABASE: ${DB_NAME} | ||
#MYSQL_USER: app_db_user | ||
#MYSQL_PASSWORD: app_db_password | ||
networks: | ||
- dev | ||
#PHP My Admin | ||
phpmyadmin: | ||
container_name: ${APP_NAME}-pma | ||
image: phpmyadmin:latest | ||
restart: always | ||
depends_on: | ||
- database | ||
ports: | ||
- "8081:80" | ||
environment: | ||
PMA_HOST: db | ||
networks: | ||
- dev | ||
#Network | ||
networks: | ||
dev: | ||
#Volumes | ||
volumes: | ||
db-data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
version: "3.8" | ||
services: | ||
|
||
database: | ||
container_name: ${APP_NAME}-database | ||
image: mysql:5.7 | ||
platform: linux/amd64 | ||
ports: | ||
- "3306:3306" | ||
restart: always | ||
environment: | ||
#MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' | ||
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD} | ||
MYSQL_DATABASE: ${DB_NAME} | ||
#MYSQL_USER: app_db_user | ||
#MYSQL_PASSWORD: app_db_password | ||
volumes: | ||
- ../var/dbdata:/var/lib/mysql | ||
#PHP My Admin | ||
phpmyadmin: | ||
container_name: ${APP_NAME}-pma | ||
image: phpmyadmin:latest | ||
restart: always | ||
depends_on: | ||
- database | ||
ports: | ||
- "8081:80" | ||
environment: | ||
PMA_HOST: db | ||
networks: | ||
- dev | ||
#Network | ||
networks: | ||
dev: | ||
#Volumes | ||
volumes: | ||
db-data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,31 @@ | ||
<?php | ||
// Démarrage de la session PHP pour la gestion des variables de session | ||
use Studoo\EduFramework\Core\ConfigCore; | ||
use Studoo\EduFramework\Core\LoadCouchCore; | ||
|
||
// Autoloader => chargement automatique des classes depuis le dossier vendor/ | ||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
session_start(); | ||
|
||
// Utilisation des classes utilisées dans le fichier | ||
use Controller\HomeController; | ||
use Dotenv\Dotenv; | ||
use Studoo\EduFramework\Core\Controller\FastRouteCore; | ||
use Studoo\EduFramework\Core\Service\DatabaseService; | ||
use Studoo\EduFramework\Core\View\TwigCore; | ||
// Masquer les deprecations de PHP 8.1 | ||
error_reporting(E_ALL & ~E_DEPRECATED); | ||
|
||
// Gestion des fichiers environnement .env | ||
$dotenv = Dotenv::createImmutable(__DIR__ . "/../"); | ||
$dotenv->load(); | ||
if (version_compare(PHP_VERSION, '8.0', '<') === false) { | ||
// Autoloader => chargement automatique des classes depuis le dossier vendor/ | ||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
|
||
// Gestion de la couche View | ||
(new TwigCore(__DIR__ . '/../app/Template')); | ||
$en = TwigCore::getEnvironment(); | ||
// Chargement des configurations de l'application | ||
(new ConfigCore( | ||
[ | ||
'base_path' => __DIR__ . '/../', | ||
'twig_path' => __DIR__ . '/../app/Template', | ||
'route_config_path' => __DIR__ . '/../app/config/' | ||
] | ||
) | ||
); | ||
|
||
// Gestion de la couche Model et de la connexion à la base de données | ||
if ($_ENV['DB_HOST_STATUS'] === 'true') { | ||
(new DatabaseService()); | ||
} | ||
|
||
// Gestion des routes | ||
$route = new FastRouteCore(); | ||
// Load des routes depuis le fichier de configuration | ||
$route->loadRouteConfig(__DIR__ . '/../app/config/'); | ||
|
||
// Récupération de la route à appeler | ||
try { | ||
echo $route->getRoute(); | ||
} catch (\Twig\Error\LoaderError|\Twig\Error\RuntimeError|\Twig\Error\SyntaxError|Exception $e) { | ||
echo $e->getMessage(); | ||
// Chargement des classes utilisées par l'application | ||
(new LoadCouchCore())->run(); | ||
} else { | ||
echo "Cet app nécessite au moins PHP8.0. " | ||
. PHP_VERSION . | ||
" est actuellement installé. Veuillez mettre à jour votre version de PHP.\n"; | ||
} |