diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0d2829b..6085c8b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,8 +7,6 @@ on: - '*.x' - '*.*.x' pull_request: - schedule: - - cron: '0 0 * * 0' jobs: php-tests: diff --git a/app/providers/class-route-service-provider.php b/app/providers/class-route-service-provider.php deleted file mode 100644 index 3de4682..0000000 --- a/app/providers/class-route-service-provider.php +++ /dev/null @@ -1,33 +0,0 @@ -allow_pass_through_requests(); - } - - /** - * Define routes for the application. - */ - public function map(): void { - Route::middleware( 'web' )->group( base_path( 'routes/web.php' ) ); - Route::middleware( 'rest-api' )->group( base_path( 'routes/rest-api.php' ) ); - } -} diff --git a/bin/mantle b/bin/mantle index d64576d..5e2af4a 100755 --- a/bin/mantle +++ b/bin/mantle @@ -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'; /* |-------------------------------------------------------------------------- @@ -42,6 +42,4 @@ $app = require_once MANTLE_BASE_DIR . '/bootstrap/app.php'; | */ -bootloader( $app ) - ->set_base_path( MANTLE_BASE_DIR ) - ->boot(); +$bootloader->boot(); diff --git a/bootstrap/app.php b/bootstrap/app.php index 1f856d2..61691ce 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -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, + ); diff --git a/composer.json b/composer.json index cc7280b..b6792bb 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/config/app.php b/config/app.php index 730d12f..5dd89f0 100644 --- a/config/app.php +++ b/config/app.php @@ -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, ], /* diff --git a/mantle.php b/mantle.php index 4f6ad61..b6199be 100644 --- a/mantle.php +++ b/mantle.php @@ -80,7 +80,7 @@ function () { | */ -$app = require_once __DIR__ . '/bootstrap/app.php'; +$bootloader = require_once __DIR__ . '/bootstrap/app.php'; /* |-------------------------------------------------------------------------- @@ -92,4 +92,4 @@ function () { | */ -bootloader( $app )->boot(); +$bootloader->boot(); diff --git a/phpcs.xml b/phpcs.xml index e79c9e8..26b5f67 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -33,6 +33,7 @@ + views/ diff --git a/tests/CreateApplication.php b/tests/CreateApplication.php index e4f6de6..e6dac57 100644 --- a/tests/CreateApplication.php +++ b/tests/CreateApplication.php @@ -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(); } }