+add composer.json + update autoloader

This commit is contained in:
xdrm-brackets 2018-02-19 23:01:42 +01:00
parent c41e024c9d
commit 5be434f4c7
3 changed files with 29 additions and 37 deletions

View File

@ -18,42 +18,7 @@
} }
\session_start();
/* Secure Hash Function
*
* @raw<String> Data to hash
* @salt<String> Salt to use for hashing
* @pepper<String> Pepper to use for hashing
*
*/
function secure_hash(String $raw, String $salt='2104\'dsa:">AS"D:', String $pepper='3894.234123;\'21'){
return hash('sha512', $pepper.hash('sha512', $raw.$salt));
}
/* AUTOLOADER
*
* @className<String> Nom de la classe appelee
*
*/
function autoloader($className){
$path = '';
/* [1] On utilise le namespace pour localiser
===============================================*/
// On remplace les '\' par des '/'
$path = str_replace('\\', '/', $className) . '.php';
$path = __BUILD__.'/'.$path;
// Si le fichier existe
if( file_exists($path) )
require_once $path; // on inclue le fichier
}
// On definit l'autoloader comme autoloader (obvious)
spl_autoload_register('autoloader', false, true);
?> ?>

27
composer.json Normal file
View File

@ -0,0 +1,27 @@
{
"name": "ptut",
"description": "PTUT website",
"license": "proprietary",
"authors": [
{
"name": "xdrm-brackets",
"email": "xdrm.brackets.dev@gmail.com"
}, {
"name": "SeekDasky",
"email": "mascaro.lucas@yahoo.fr"
}, {
"name": "G. Fauvet",
"email": "gfauvet@gmail.com"
}
],
"autoload": {
"psr-4": {
"api\\": "build/api",
"database\\": "build/database",
"error\\": "build/error",
"http\\": "build/http",
"router\\": "build/router"
},
"files": ["autoloader.php"]
}
}

View File

@ -1,4 +1,4 @@
<?php require_once '../autoloader.php'; <?php require_once '../vendor/autoload.php';
use \router\core\Router; use \router\core\Router;
use \database\core\Repo; use \database\core\Repo;