Skip to content

Commit 1d878cc

Browse files
authored
[11.x] Slim skeleton support (#47309)
### 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.
1 parent 2cefd2c commit 1d878cc

File tree

79 files changed

+4085
-134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+4085
-134
lines changed

.github/workflows/databases.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ jobs:
5252
env:
5353
DB_CONNECTION: mysql
5454
DB_USERNAME: root
55+
MYSQL_COLLATION: utf8mb4_unicode_ci
5556

5657
mysql_8:
5758
runs-on: ubuntu-22.04
@@ -140,7 +141,7 @@ jobs:
140141
- name: Execute tests
141142
run: vendor/bin/phpunit tests/Integration/Database
142143
env:
143-
DB_CONNECTION: mysql
144+
DB_CONNECTION: mariadb
144145
DB_USERNAME: root
145146

146147
pgsql:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
"league/flysystem-sftp-v3": "^3.0",
107107
"mockery/mockery": "^1.5.1",
108108
"nyholm/psr7": "^1.2",
109-
"orchestra/testbench-core": "^9.0",
109+
"orchestra/testbench-core": "dev-next/slim-skeleton",
110110
"pda/pheanstalk": "^4.0",
111111
"phpstan/phpstan": "^1.4.7",
112112
"phpunit/phpunit": "^10.1",

config/app.php

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Facade;
4+
use Illuminate\Support\ServiceProvider;
5+
6+
return [
7+
8+
/*
9+
|--------------------------------------------------------------------------
10+
| Application Name
11+
|--------------------------------------------------------------------------
12+
|
13+
| This value is the name of your application, which will be used when the
14+
| framework needs to place the application's name in a notification or
15+
| any other location as required by the application or its packages.
16+
|
17+
*/
18+
19+
'name' => env('APP_NAME', 'Laravel'),
20+
21+
/*
22+
|--------------------------------------------------------------------------
23+
| Application Environment
24+
|--------------------------------------------------------------------------
25+
|
26+
| This value determines the "environment" your application is currently
27+
| running in. This may determine how you prefer to configure various
28+
| services the application utilizes. Set this in your ".env" file.
29+
|
30+
*/
31+
32+
'env' => env('APP_ENV', 'production'),
33+
34+
/*
35+
|--------------------------------------------------------------------------
36+
| Application Debug Mode
37+
|--------------------------------------------------------------------------
38+
|
39+
| When your application is in debug mode, detailed error messages with
40+
| stack traces will be shown on every error that occurs within your
41+
| application. If disabled, a simple generic error page is shown.
42+
|
43+
*/
44+
45+
'debug' => (bool) env('APP_DEBUG', false),
46+
47+
/*
48+
|--------------------------------------------------------------------------
49+
| Application URL
50+
|--------------------------------------------------------------------------
51+
|
52+
| This URL is used by the console to properly generate URLs when using
53+
| the Artisan command line tool. You should set this to the root of
54+
| your application so that it is used when running Artisan tasks.
55+
|
56+
*/
57+
58+
'url' => env('APP_URL', 'http://localhost'),
59+
60+
'frontend_url' => env('FRONTEND_URL', 'http://localhost:3000'),
61+
62+
'asset_url' => env('ASSET_URL'),
63+
64+
/*
65+
|--------------------------------------------------------------------------
66+
| Application Timezone
67+
|--------------------------------------------------------------------------
68+
|
69+
| Here you may specify the default timezone for your application, which
70+
| will be used by the PHP date and date-time functions. The timezone
71+
| is set to "UTC" by default as it is suitable for most use cases.
72+
|
73+
*/
74+
75+
'timezone' => env('APP_TIMEZONE', 'UTC'),
76+
77+
/*
78+
|--------------------------------------------------------------------------
79+
| Application Locale Configuration
80+
|--------------------------------------------------------------------------
81+
|
82+
| The application locale determines the default locale that will be used
83+
| by the translation service provider. You are free to set this value
84+
| to any of the locales which will be supported by the application.
85+
|
86+
*/
87+
88+
'locale' => env('APP_LOCALE', 'en'),
89+
90+
/*
91+
|--------------------------------------------------------------------------
92+
| Application Fallback Locale
93+
|--------------------------------------------------------------------------
94+
|
95+
| The fallback locale determines the locale to use when the default one
96+
| is not available. You may change the value to correspond to any of
97+
| the languages which are currently supported by your application.
98+
|
99+
*/
100+
101+
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
102+
103+
/*
104+
|--------------------------------------------------------------------------
105+
| Faker Locale
106+
|--------------------------------------------------------------------------
107+
|
108+
| This locale will be used by the Faker PHP library when generating fake
109+
| data for your database seeds. For example, this will be used to get
110+
| localized telephone numbers, street address information and more.
111+
|
112+
*/
113+
114+
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
115+
116+
/*
117+
|--------------------------------------------------------------------------
118+
| Encryption Key
119+
|--------------------------------------------------------------------------
120+
|
121+
| This key is utilized by Laravel's encryption services and should be set
122+
| to a random, 32 character string or all of the encrypted strings are
123+
| not secure. You should do this prior to deploying the application.
124+
|
125+
*/
126+
127+
'key' => env('APP_KEY'),
128+
129+
'cipher' => 'AES-256-CBC',
130+
131+
/*
132+
|--------------------------------------------------------------------------
133+
| Maintenance Mode Driver
134+
|--------------------------------------------------------------------------
135+
|
136+
| These configuration options determine the driver used to determine and
137+
| manage Laravel's "maintenance mode" status. The "cache" driver will
138+
| allow maintenance mode to be controlled across multiple machines.
139+
|
140+
| Supported drivers: "file", "cache"
141+
|
142+
*/
143+
144+
'maintenance' => [
145+
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
146+
'store' => env('APP_MAINTENANCE_STORE', 'redis'),
147+
],
148+
149+
/*
150+
|--------------------------------------------------------------------------
151+
| Autoloaded Service Providers
152+
|--------------------------------------------------------------------------
153+
|
154+
| The service providers listed here will be automatically loaded on any
155+
| requests to your application. You may add your own services to the
156+
| arrays below to provide additional features to this application.
157+
|
158+
*/
159+
160+
'providers' => ServiceProvider::defaultProviders()->merge([
161+
// Package Service Providers...
162+
])->merge([
163+
// Application Service Providers...
164+
// App\Providers\AppServiceProvider::class,
165+
])->merge([
166+
// Added Service Providers (Do not remove this line)...
167+
])->toArray(),
168+
169+
/*
170+
|--------------------------------------------------------------------------
171+
| Class Aliases
172+
|--------------------------------------------------------------------------
173+
|
174+
| This array of class aliases will be registered when this application
175+
| is started. You may add any additional class aliases which should
176+
| be loaded to the array. For speed, all aliases are lazy loaded.
177+
|
178+
*/
179+
180+
'aliases' => Facade::defaultAliases()->merge([
181+
// 'Example' => App\Facades\Example::class,
182+
])->toArray(),
183+
184+
];

config/auth.php

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Authentication Defaults
8+
|--------------------------------------------------------------------------
9+
|
10+
| This option controls the default authentication "guard" and password
11+
| reset options for your application. You may change these defaults
12+
| as required, but they're a perfect start for most applications.
13+
|
14+
*/
15+
16+
'defaults' => [
17+
'guard' => env('AUTH_GUARD', 'web'),
18+
'passwords' => 'users',
19+
],
20+
21+
/*
22+
|--------------------------------------------------------------------------
23+
| Authentication Guards
24+
|--------------------------------------------------------------------------
25+
|
26+
| Next, you may define every authentication guard for your application.
27+
| Of course, a great default configuration has been defined for you
28+
| which utilizes session storage plus the Eloquent user provider.
29+
|
30+
| All authentication drivers have a user provider. This defines how the
31+
| users are actually retrieved out of your database or other storage
32+
| mechanisms used by this application to persist your user's data.
33+
|
34+
| Supported: "session"
35+
|
36+
*/
37+
38+
'guards' => [
39+
'web' => [
40+
'driver' => 'session',
41+
'provider' => 'users',
42+
],
43+
],
44+
45+
/*
46+
|--------------------------------------------------------------------------
47+
| User Providers
48+
|--------------------------------------------------------------------------
49+
|
50+
| All authentication drivers have a user provider. This defines how the
51+
| users are actually retrieved out of your database or other storage
52+
| mechanisms used by this application to persist your user's data.
53+
|
54+
| If you have multiple user tables or models you may configure multiple
55+
| sources which represent each model / table. These sources may then
56+
| be assigned to any extra authentication guards you have defined.
57+
|
58+
| Supported: "database", "eloquent"
59+
|
60+
*/
61+
62+
'providers' => [
63+
'users' => [
64+
'driver' => 'eloquent',
65+
'model' => env('AUTH_MODEL', App\Models\User::class),
66+
],
67+
68+
// 'users' => [
69+
// 'driver' => 'database',
70+
// 'table' => 'users',
71+
// ],
72+
],
73+
74+
/*
75+
|--------------------------------------------------------------------------
76+
| Resetting Passwords
77+
|--------------------------------------------------------------------------
78+
|
79+
| You may specify multiple password reset configurations if you have more
80+
| than one user table or model in the application and you want to have
81+
| separate password reset settings based on the specific user types.
82+
|
83+
| The expiry time is the number of minutes that each reset token will be
84+
| considered valid. This security feature keeps tokens short-lived so
85+
| they have less time to be guessed. You may change this as needed.
86+
|
87+
| The throttle setting is the number of seconds a user must wait before
88+
| generating more password reset tokens. This prevents the user from
89+
| quickly generating a very large amount of password reset tokens.
90+
|
91+
*/
92+
93+
'passwords' => [
94+
'users' => [
95+
'provider' => 'users',
96+
'table' => 'password_reset_tokens',
97+
'expire' => 60,
98+
'throttle' => 60,
99+
],
100+
],
101+
102+
/*
103+
|--------------------------------------------------------------------------
104+
| Password Confirmation Timeout
105+
|--------------------------------------------------------------------------
106+
|
107+
| Here you may define the amount of seconds before a password confirmation
108+
| window expires and users are asked to re-enter their password via the
109+
| confirmation screen. By default, the timeout lasts for three hours.
110+
|
111+
*/
112+
113+
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
114+
115+
];

config/broadcasting.php

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Default Broadcaster
8+
|--------------------------------------------------------------------------
9+
|
10+
| This option controls the default broadcaster that will be used by the
11+
| framework when an event needs to be broadcast. You may set this to
12+
| any of the connections defined in the "connections" array below.
13+
|
14+
| Supported: "pusher", "ably", "redis", "log", "null"
15+
|
16+
*/
17+
18+
'default' => env('BROADCAST_CONNECTION', 'null'),
19+
20+
/*
21+
|--------------------------------------------------------------------------
22+
| Broadcast Connections
23+
|--------------------------------------------------------------------------
24+
|
25+
| Here you may define all of the broadcast connections that will be used
26+
| to broadcast events to other systems or over websockets. Samples of
27+
| each available type of connection are provided inside this array.
28+
|
29+
*/
30+
31+
'connections' => [
32+
33+
'pusher' => [
34+
'driver' => 'pusher',
35+
'key' => env('PUSHER_APP_KEY'),
36+
'secret' => env('PUSHER_APP_SECRET'),
37+
'app_id' => env('PUSHER_APP_ID'),
38+
'options' => [
39+
'cluster' => env('PUSHER_APP_CLUSTER'),
40+
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
41+
'port' => env('PUSHER_PORT', 443),
42+
'scheme' => env('PUSHER_SCHEME', 'https'),
43+
'encrypted' => true,
44+
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
45+
],
46+
'client_options' => [
47+
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
48+
],
49+
],
50+
51+
'ably' => [
52+
'driver' => 'ably',
53+
'key' => env('ABLY_KEY'),
54+
],
55+
56+
'redis' => [
57+
'driver' => 'redis',
58+
'connection' => env('REDIS_BROADCASTING_CONNECTION', 'default'),
59+
],
60+
61+
'log' => [
62+
'driver' => 'log',
63+
],
64+
65+
'null' => [
66+
'driver' => 'null',
67+
],
68+
69+
],
70+
71+
];

0 commit comments

Comments
 (0)