Skip to content

Commit

Permalink
Merge pull request #254 from alleyinteractive/release/1.0
Browse files Browse the repository at this point in the history
Work to lighten up the base application
  • Loading branch information
srtfisher authored Jul 3, 2024
2 parents 6f57cf3 + dedc85b commit 260a01a
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 90 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
- '*.x'
- '*.*.x'
pull_request:
schedule:
- cron: '0 0 * * 0'

jobs:
php-tests:
Expand Down
33 changes: 0 additions & 33 deletions app/providers/class-route-service-provider.php

This file was deleted.

6 changes: 2 additions & 4 deletions bin/mantle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if ( file_exists( __DIR__ . '/../vendor/autoload.php' ) ) {
|
*/

$app = require_once MANTLE_BASE_DIR . '/bootstrap/app.php';
$bootloader = require_once MANTLE_BASE_DIR . '/bootstrap/app.php';

/*
|--------------------------------------------------------------------------
Expand All @@ -42,6 +42,4 @@ $app = require_once MANTLE_BASE_DIR . '/bootstrap/app.php';
|
*/

bootloader( $app )
->set_base_path( MANTLE_BASE_DIR )
->boot();
$bootloader->boot();
38 changes: 12 additions & 26 deletions bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,16 @@
* @package Mantle
*/

use Mantle\Contracts;
use Mantle\Application\Application;
use Mantle\Framework\Bootloader;

/**
* Instantiate the application
*/
$app = new Application();

/**
* Register the main contracts that power the application.
*/
$app->singleton(
Contracts\Console\Kernel::class,
App\Console\Kernel::class,
);

$app->singleton(
Contracts\Http\Kernel::class,
App\Http\Kernel::class,
);

$app->singleton(
Contracts\Exceptions\Handler::class,
App\Exceptions\Handler::class
);

return $app;
return Bootloader::create()
->with_kernels(
console: App\Console\Kernel::class,
http: App\Http\Kernel::class,
)
->with_exception_handler( App\Exceptions\Handler::class )
->with_routing(
web: __DIR__ . '/../routes/web.php',
rest_api: __DIR__ . '/../routes/rest-api.php',
pass_through: true,
);
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"require": {
"alleyinteractive/composer-wordpress-autoloader": "^1.0",
"alleyinteractive/mantle-framework": "^1.0",
"alleyinteractive/mantle-framework": "^1.1",
"fakerphp/faker": "^1.23"
},
"require-dev": {
Expand Down
14 changes: 1 addition & 13 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,13 @@
|--------------------------------------------------------------------------
|
| Providers listed here will be autoloaded for every request on the application.
| The providers listed here will be merged with the default framework providers.
|
*/
'providers' => [
// Framework Providers.
Mantle\Filesystem\Filesystem_Service_Provider::class,
Mantle\Database\Factory_Service_Provider::class,
Mantle\Framework\Providers\Error_Service_Provider::class,
Mantle\Database\Model_Service_Provider::class,
Mantle\Queue\Queue_Service_Provider::class,
Mantle\Query_Monitor\Query_Monitor_Service_Provider::class,
Mantle\New_Relic\New_Relic_Service_Provider::class,
Mantle\Database\Pagination\Paginator_Service_Provider::class,
Mantle\Cache\Cache_Service_Provider::class,

// Application Providers.
App\Providers\App_Service_Provider::class,
App\Providers\Asset_Service_Provider::class,
App\Providers\Event_Service_Provider::class,
App\Providers\Route_Service_Provider::class,
],

/*
Expand Down
4 changes: 2 additions & 2 deletions mantle.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function () {
|
*/

$app = require_once __DIR__ . '/bootstrap/app.php';
$bootloader = require_once __DIR__ . '/bootstrap/app.php';

/*
|--------------------------------------------------------------------------
Expand All @@ -92,4 +92,4 @@ function () {
|
*/

bootloader( $app )->boot();
$bootloader->boot();
1 change: 1 addition & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<properties>
<property name="prefixes" type="array">
<element value="App"/>
<element value="bootloader"/>
</property>
</properties>
<exclude-pattern>views/</exclude-pattern>
Expand Down
12 changes: 3 additions & 9 deletions tests/CreateApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,10 @@ trait CreateApplication {
* @return \Mantle\Application\Application
*/
public function create_application(): \Mantle\Contracts\Application {
// Allow non-mantle-site usage.
if ( ! file_exists( __DIR__ . '/../bootstrap/app.php' ) ) {
echo "Application bootstrap not found: creating new instance...";
return new Application( __DIR__ . '/../', home_url( '/' ) );
}
$bootloader = require __DIR__ . '/../bootstrap/app.php';

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

$app->make( Kernel::class )->bootstrap();

return $app;
return $bootloader->get_application();
}
}

0 comments on commit 260a01a

Please sign in to comment.