Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.x] Slim skeleton #47309

Merged
merged 120 commits into from
Nov 28, 2023
Merged

[11.x] Slim skeleton #47309

merged 120 commits into from
Nov 28, 2023

Conversation

taylorotwell
Copy link
Member

@taylorotwell taylorotwell commented Jun 1, 2023

laravel/laravel#6188

Laravel 11 Framework Overview

Configuration

All configuration files now have framework counterparts and application level configuration is merged with the framework defaults. The default configuration files have also received many more environment variables so that more options can be changed from the application’s .env file. The LoadConfiguration bootstrap class has been added to support framework configuration cascading. A new config:publish command has been introduced to publish framework configuration files.

Middleware

The Authenticate middleware and AuthenticationException exception now have redirectUsing methods that accept a closure. This closure will be invoked to determine where to redirect unauthenticated users. Helper methods for setting this closure are available on the Middleware application builder class.

The Authenticate middleware also now does not return a redirect location if the incoming request expected JSON.

The RedirectIfAuthenticated middleware has been added to the framework. This middleware also includes a redirectUsing method to customize the “guest” redirection behavior. The default behavior is to redirect to /dashboard. Helper methods for setting this closure are available on the Middleware application builder class.

The AuthenticateSession middleware has received a redirectUsing helper to control the redirection behavior. Helper methods for setting this closure are available on the Middleware application builder class.

The TrimStrings middleware has received an except method that may be used to specify which strings should not be trimmed.

The ValidateCsrfToken middleware has received an except method that may be used to specify which paths should not receive CSRF token validation.

The ValidateSignature middleware has receive an except method that may be used to specify which parameters should not be included in signature validation.

ValidateCsrfToken has been added as an alias of VerifyCsrfToken.

The TrustHosts middleware has been updated to allow all subdomains of the application’s configured URL by default.

The TrustProxies middleware has been updated to trust all proxies by default.

The EncryptCookies middleware has received a static except method which may be used in a service provider to specify the cookies that should not be encrypted.

Events

The foundation EventServiceProvider has been updated to discover events by default. In addition, the email verification listener to send email verification notifications is now configured automatically if no Registered event listeners exist or the SendEmailVerificatioNotification listener is not in the list of listeners for the Registered event.

Notificiations

A slack configuration array has been added to the framework's copy of the services.php configuration file.

Artisan Commands

The cache:table command has received a make:cache-table alias to move all generation commands under the make namespace. The notifications:table command has receive a make:notifications-table alias to move all generation commands under the make namespace. The queue:batches-table command has received a make:queue-batches-table alias for the same reason as above. The queue:failed-table command has received a make:queue-failed-table alias for the same reason as above. In addition, queue:table has received a make:queue-table alias. Also, session:table has received a make:session-table alias.

A schedule command has been added to closure commands, allowing the fluent scheduling of closure commands in the console routes file.

The console scheduler is now available via a Schedule facade.

The optimize command now also caches views and events.

Service Providers

The RegisterProviders bootstrap class has been updated to support the loading of additional providers from the bootstrap/providers.php array file.

The make:provider command has been updated to add the new service provider to the bootstrap/providers.php file if it exists.

The ServiceProvider class has received a new static addProviderToBootstrapFile method that will add a service provider class to the bootstrap/providers.php file if it exists.

Application Configuration

The Application class has received several new methods and helpers. A new registered listener method has been added to allow code to react to the registration service providers. A new getBootstrapProvidersPath method has been added that returns the location to the bootstrap providers file. New handleRequest and handleCommands method have been added in order to clean up and simplify the application level bootstrap / index files.

A new configure method has been added to the Application class in order to allow the fluent configuration of multiple framework features, including routing and container bindings.

A new ApplicationBuilder class has been introduced to allow the easy configuration of a variety of core framework functionality, including routing, commands, middleware, exception handling, booting / booted callbacks, and more.

A new Middleware application configuration class has been introduced that allows the easy definition of new middleware groups, prepending and appending of middleware to existing groups, replacing middleware in existing groups, and fluent methods for enabling middleware like TrustHosts and EnsureFrontendRequestsAreStateful.

Helper methods have been added to the exception handler for dontReport, dontReportDuplicates, dontFlash, buildContextUsing.

Installers

A new install:api command has been added. This command installs laravel/sanctum and uncomments the “API” routes definition in the bootstrap file.

A new install:broadcasting has been added which uncomments the “channels” routes definition in the bootstrap file. In addition, a Laravel Echo file is written to the resources/js directory which contains the Echo configuration. A directive to include this file is injected into the main bootstrap.js file.

@taylorotwell taylorotwell marked this pull request as draft June 1, 2023 19:01
@laravel laravel locked as resolved and limited conversation to collaborators Jun 1, 2023
@driesvints driesvints changed the title Slim skeleton [11.x] Slim skeleton Jun 7, 2023
@taylorotwell taylorotwell force-pushed the slim-skeleton-11.x branch 2 times, most recently from ab3c1b8 to 7e39af5 Compare June 8, 2023 20:26
@taylorotwell taylorotwell force-pushed the slim-skeleton-11.x branch 3 times, most recently from 403ab9f to b5299bb Compare July 15, 2023 20:26
@taylorotwell taylorotwell force-pushed the slim-skeleton-11.x branch 2 times, most recently from 05ae303 to 24a2473 Compare August 29, 2023 14:56
@taylorotwell taylorotwell force-pushed the slim-skeleton-11.x branch 2 times, most recently from 17afb52 to f99a90f Compare September 13, 2023 20:48
@taylorotwell taylorotwell force-pushed the slim-skeleton-11.x branch 2 times, most recently from b70ebc8 to d8f44e3 Compare October 2, 2023 18:23
* Begin configuring a new Laravel application instance.
*
* @param string|null $baseDirectory
* @return \Illuminate\Foundation\ApplicationBuilder
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @return \Illuminate\Foundation\ApplicationBuilder
* @return \Illuminate\Foundation\Configuration\ApplicationBuilder

public static function configure(string $baseDirectory = null)
{
$baseDirectory = $ENV['APP_BASE_PATH'] ?? ($baseDirectory ?: dirname(dirname(
debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0]['file']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably can use Composer's runtime classes to grab this directory, so we don't have to use the backtrace here.

*/
public static function configure(string $baseDirectory = null)
{
$baseDirectory = $ENV['APP_BASE_PATH'] ?? ($baseDirectory ?: dirname(dirname(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use dirname($path, 2).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels that this should be the other way around, so: $baseDirectory > ENV > reflection...

if (! isset($files['app'])) {
throw new Exception('Unable to load the "app" configuration file.');
// if (! isset($files['app'])) {
// throw new Exception('Unable to load the "app" configuration file.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unclear for me this commented code.

@@ -20,7 +20,7 @@ class OptimizeCommand extends Command
*
* @var string
*/
protected $description = 'Cache the framework bootstrap files';
protected $description = 'Cache framework bootstrap, configuration, and metadata to increase performance';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if we should come up with a new command name to avoid this BC.

*
* @var array
*/
protected $aliases = ['notifications:table'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably mark all these aliases as @deprecated. cc @driesvints

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nunomaduro agreed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm on second thought this could maybe not hurt. People have been used to these command names for a while. Maybe it's best we support them indefinitely?

taylorotwell and others added 26 commits November 28, 2023 13:39
…ds (#48137)

* Adds `Artisan::command()->schedule(...)`

* Apply fixes from StyleCI

* formatting

---------

Co-authored-by: StyleCI Bot <[email protected]>
Co-authored-by: Taylor Otwell <[email protected]>
* Add MariaDB to databases config and Change MySQL 8 collation

* Update tests workflow for MariaDB

* Update default collation for mariadb
* Test Improvements

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* Fix MariaDB Tests with changed query

* Fix Testbench version

* Allow to override collation using DB_COLLATION

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

---------

Signed-off-by: Mior Muhammad Zaki <[email protected]>
Co-authored-by: Julius Kiekbusch <[email protected]>
@taylorotwell taylorotwell marked this pull request as ready for review November 28, 2023 20:23
@taylorotwell taylorotwell merged commit 1d878cc into master Nov 28, 2023
15 of 33 checks passed
@taylorotwell taylorotwell deleted the slim-skeleton-11.x branch November 28, 2023 20:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants