Skip to content

Commit 5c805d5

Browse files
committed
added namespaces to all important classes && updated composer.json
1 parent 3f98177 commit 5c805d5

11 files changed

Lines changed: 29 additions & 28 deletions

File tree

index.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
<?php
22
// header config
3-
require __DIR__ . '/src/config/headers.php';
3+
require __DIR__ . '/src/Config/headers.php';
44
// request/response
5-
require __DIR__ . '/src/core/respond.php';
6-
require __DIR__ . '/src/core/request.php';
5+
require __DIR__ . '/src/Core/respond.php';
6+
require __DIR__ . '/src/Core/request.php';
77

88
// router
9-
require_once __DIR__ . '/src/core/router.php';
9+
require_once __DIR__ . '/src/Core/router.php';
1010

1111
// core modules
12-
require __DIR__ . '/src/core/fieldValidate.php';
13-
require __DIR__ . '/src/core/date.php';
12+
require __DIR__ . '/src/Core/fieldValidate.php';
13+
require __DIR__ . '/src/Core/date.php';
1414

1515
// helpers
16-
require __DIR__ . '/src/helpers/constants.php';
17-
require __DIR__ . '/src/helpers/jwt.php';
16+
require __DIR__ . '/src/Helpers/constants.php';
17+
require __DIR__ . '/src/Helpers/jwt.php';
1818

1919
// config files
20-
require __DIR__ . '/src/config/db.php';
20+
require __DIR__ . '/src/Config/db.php';
2121

2222
// dependent modules
23-
require __DIR__ . '/src/core/auth.php';
23+
require __DIR__ . '/src/Core/auth.php';
2424

2525
// module init
26-
require __DIR__ . '/src/config/init.php';
26+
require __DIR__ . '/src/Config/init.php';
2727

2828
// routes
2929
require __DIR__ . '/routes/index.php';

src/config/db.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace Leaf;
2+
namespace Leaf\Config;
33

44
class Database {
55
public function connectMysqli($host, $user, $password, $dbname) {

src/config/init.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
// $password = '';
55
// $dbname = 'books';
66

7-
// $database = new \Leaf\Database();
7+
// $database = new \Leaf\Config\Database();
88
// $connection = $database->connectMysqli($host, $user, $password, $dbname);
99

10-
$leaf = new \Leaf\Router();
10+
$leaf = new \Leaf\Core\Router();
1111

12-
$response = new \Leaf\Response();
12+
$response = new \Leaf\Core\Response();
1313

14-
$request = new \Leaf\Request();
14+
$request = new \Leaf\Core\Request();
1515

16-
$validate = new \Leaf\Validation($response);
16+
$validate = new \Leaf\Core\Validation($response);
1717

18-
$date = new \Leaf\CustomDate();
18+
$date = new \Leaf\Core\CustomDate();
1919

20-
$jwt = new \Leaf\JWT();
20+
$jwt = new \Leaf\Helpers\JWT();
2121

22-
$authentication = new \Leaf\Authentication();
22+
$authentication = new \Leaf\Core\Authentication();

src/core/auth.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
2-
namespace Leaf;
2+
namespace Leaf\Core;
3+
use \Leaf\Helpers\JWT;
34

45
class Authentication extends JWT {
56
public function generateSimpleToken($user_id, $secret_phrase) {

src/core/date.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace Leaf;
2+
namespace Leaf\Core;
33
use \DateTime;
44

55
class CustomDate {

src/core/fieldValidate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace Leaf;
2+
namespace Leaf\Core;
33

44
class Validation extends Response {
55

src/core/request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace Leaf;
2+
namespace Leaf\Core;
33

44
class Request {
55
public function __construct() {

src/core/respond.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace Leaf;
2+
namespace Leaf\Core;
33

44
class Response {
55
public function respond($data) {

src/core/router.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* based on https://github.com/bramus/router
44
*/
5-
namespace Leaf;
5+
namespace Leaf\Core;
66

77
class Router
88
{

src/helpers/constants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace Leaf;
2+
namespace Leaf\Helpers;
33

44
/*Data Type*/
55
define('BOOLEAN', '1');

0 commit comments

Comments
 (0)