Skip to content

Commit a31ac8d

Browse files
committed
support env
1 parent ed110a8 commit a31ac8d

File tree

8 files changed

+33
-16
lines changed

8 files changed

+33
-16
lines changed

.php-cs-fixer.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,10 @@
209209
'elements' => ['method', 'property'],
210210
],
211211
'whitespace_after_comma_in_array' => true,
212-
]);
212+
])->setFinder(
213+
PhpCsFixer\Finder::create()
214+
->exclude('public')
215+
->exclude('runtime')
216+
->exclude('vendor')
217+
->in(__DIR__)
218+
);

bin/bootstrap.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
declare(strict_types=1);
44

5+
use MicroPHP\Framework\Application;
56

6-
require __DIR__.'/../vendor/autoload.php';
7+
require __DIR__ . '/../vendor/autoload.php';
78

89
date_default_timezone_set('Asia/Shanghai');
910

10-
! defined('BASE_PATH') && define('BASE_PATH', __DIR__ . '/../');
11+
! defined('BASE_PATH') && define('BASE_PATH', __DIR__ . '/../');
12+
13+
/** @noinspection PhpUnhandledExceptionInspection */
14+
return Application::boot();

bin/console

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
<?php
33
declare(strict_types=1);
44

5+
use MicroPHP\Framework\Application;
56
use MicroPHP\Framework\ConsoleApplication;
67

7-
require_once 'bootstrap.php';
8+
/** @var Application $application */
9+
$application = require_once 'bootstrap.php';
810

911
/** @noinspection PhpUnhandledExceptionInspection */
10-
ConsoleApplication::boot();
12+
ConsoleApplication::boot($application);

bin/index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use MicroPHP\Framework\Application;
66

7-
require_once 'bootstrap.php';
8-
7+
/** @var Application $application */
8+
$application = require_once 'bootstrap.php';
99
/** @noinspection PhpUnhandledExceptionInspection */
10-
Application::run();
10+
$application->run();

config/app.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22

33
declare(strict_types=1);
44

5+
use MicroPHP\Framework\Env;
6+
57
return [
8+
'app_name' => Env::get('APP_NAME', 'MicroPHP'),
9+
'app_env' => Env::get('APP_ENV', 'local'),
10+
'app_url' => Env::get('APP_URL', 'http://127.0.0.1:8080'),
611
'scanner' => [
712
'directories' => [
813
'app',
914
'vendor/microphp/framework/src',
10-
]
11-
]
12-
];
15+
],
16+
],
17+
];

config/commands.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22

33
declare(strict_types=1);
44

5-
65
return [
7-
];
6+
];

config/database.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
'charset' => 'utf8mb4',
1313
'collation' => 'utf8mb4_unicode_ci',
1414
'prefix' => '',
15-
]
16-
];
15+
],
16+
];

config/routes.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@
1414
$router->get('/favicon.ico', function () {
1515
return new Response(200, [], '');
1616
});
17-
return $router;
17+
18+
return $router;

0 commit comments

Comments
 (0)