Skip to content

Commit 260a01a

Browse files
authored
Merge pull request #254 from alleyinteractive/release/1.0
Work to lighten up the base application
2 parents 6f57cf3 + dedc85b commit 260a01a

File tree

9 files changed

+22
-90
lines changed

9 files changed

+22
-90
lines changed

.github/workflows/tests.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ on:
77
- '*.x'
88
- '*.*.x'
99
pull_request:
10-
schedule:
11-
- cron: '0 0 * * 0'
1210

1311
jobs:
1412
php-tests:

app/providers/class-route-service-provider.php

Lines changed: 0 additions & 33 deletions
This file was deleted.

bin/mantle

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ if ( file_exists( __DIR__ . '/../vendor/autoload.php' ) ) {
3030
|
3131
*/
3232

33-
$app = require_once MANTLE_BASE_DIR . '/bootstrap/app.php';
33+
$bootloader = require_once MANTLE_BASE_DIR . '/bootstrap/app.php';
3434

3535
/*
3636
|--------------------------------------------------------------------------
@@ -42,6 +42,4 @@ $app = require_once MANTLE_BASE_DIR . '/bootstrap/app.php';
4242
|
4343
*/
4444

45-
bootloader( $app )
46-
->set_base_path( MANTLE_BASE_DIR )
47-
->boot();
45+
$bootloader->boot();

bootstrap/app.php

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,16 @@
55
* @package Mantle
66
*/
77

8-
use Mantle\Contracts;
9-
use Mantle\Application\Application;
8+
use Mantle\Framework\Bootloader;
109

11-
/**
12-
* Instantiate the application
13-
*/
14-
$app = new Application();
15-
16-
/**
17-
* Register the main contracts that power the application.
18-
*/
19-
$app->singleton(
20-
Contracts\Console\Kernel::class,
21-
App\Console\Kernel::class,
22-
);
23-
24-
$app->singleton(
25-
Contracts\Http\Kernel::class,
26-
App\Http\Kernel::class,
27-
);
28-
29-
$app->singleton(
30-
Contracts\Exceptions\Handler::class,
31-
App\Exceptions\Handler::class
32-
);
33-
34-
return $app;
10+
return Bootloader::create()
11+
->with_kernels(
12+
console: App\Console\Kernel::class,
13+
http: App\Http\Kernel::class,
14+
)
15+
->with_exception_handler( App\Exceptions\Handler::class )
16+
->with_routing(
17+
web: __DIR__ . '/../routes/web.php',
18+
rest_api: __DIR__ . '/../routes/rest-api.php',
19+
pass_through: true,
20+
);

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
],
1212
"require": {
1313
"alleyinteractive/composer-wordpress-autoloader": "^1.0",
14-
"alleyinteractive/mantle-framework": "^1.0",
14+
"alleyinteractive/mantle-framework": "^1.1",
1515
"fakerphp/faker": "^1.23"
1616
},
1717
"require-dev": {

config/app.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,13 @@
2525
|--------------------------------------------------------------------------
2626
|
2727
| Providers listed here will be autoloaded for every request on the application.
28+
| The providers listed here will be merged with the default framework providers.
2829
|
2930
*/
3031
'providers' => [
31-
// Framework Providers.
32-
Mantle\Filesystem\Filesystem_Service_Provider::class,
33-
Mantle\Database\Factory_Service_Provider::class,
34-
Mantle\Framework\Providers\Error_Service_Provider::class,
35-
Mantle\Database\Model_Service_Provider::class,
36-
Mantle\Queue\Queue_Service_Provider::class,
37-
Mantle\Query_Monitor\Query_Monitor_Service_Provider::class,
38-
Mantle\New_Relic\New_Relic_Service_Provider::class,
39-
Mantle\Database\Pagination\Paginator_Service_Provider::class,
40-
Mantle\Cache\Cache_Service_Provider::class,
41-
42-
// Application Providers.
4332
App\Providers\App_Service_Provider::class,
4433
App\Providers\Asset_Service_Provider::class,
4534
App\Providers\Event_Service_Provider::class,
46-
App\Providers\Route_Service_Provider::class,
4735
],
4836

4937
/*

mantle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function () {
8080
|
8181
*/
8282

83-
$app = require_once __DIR__ . '/bootstrap/app.php';
83+
$bootloader = require_once __DIR__ . '/bootstrap/app.php';
8484

8585
/*
8686
|--------------------------------------------------------------------------
@@ -92,4 +92,4 @@ function () {
9292
|
9393
*/
9494

95-
bootloader( $app )->boot();
95+
$bootloader->boot();

phpcs.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<properties>
3434
<property name="prefixes" type="array">
3535
<element value="App"/>
36+
<element value="bootloader"/>
3637
</property>
3738
</properties>
3839
<exclude-pattern>views/</exclude-pattern>

tests/CreateApplication.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,10 @@ trait CreateApplication {
2020
* @return \Mantle\Application\Application
2121
*/
2222
public function create_application(): \Mantle\Contracts\Application {
23-
// Allow non-mantle-site usage.
24-
if ( ! file_exists( __DIR__ . '/../bootstrap/app.php' ) ) {
25-
echo "Application bootstrap not found: creating new instance...";
26-
return new Application( __DIR__ . '/../', home_url( '/' ) );
27-
}
23+
$bootloader = require __DIR__ . '/../bootstrap/app.php';
2824

29-
$app = require __DIR__ . '/../bootstrap/app.php';
25+
$bootloader->make( Kernel::class )->bootstrap();
3026

31-
$app->make( Kernel::class )->bootstrap();
32-
33-
return $app;
27+
return $bootloader->get_application();
3428
}
3529
}

0 commit comments

Comments
 (0)