We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f90d794 commit 48aafd6Copy full SHA for 48aafd6
resources/boost/guidelines/core.blade.php
@@ -0,0 +1,15 @@
1
+# Octane
2
+
3
+- Octane boots the application once and reuses it across requests, so singletons persist between requests.
4
+- The Laravel container's `scoped` method may be used as a safe alternative to `singleton`.
5
+- Never inject the container, request, or config repository into a singleton's constructor; use a resolver closure or `bind()` instead:
6
7
+```php
8
+// Bad
9
+$this->app->singleton(Service::class, fn (Application $app) => new Service($app['request']));
10
11
+// Good
12
+$this->app->singleton(Service::class, fn () => new Service(fn () => request()));
13
+```
14
15
+- Never append to static properties, as they accumulate in memory across requests.
0 commit comments