Skip to content

Commit 0163b8b

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents b476286 + 8aa3eaf commit 0163b8b

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

app/Front/Code/code_preview.view.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
html2canvas(screenshot, {
1717
allowTaint: true,
1818
useCORS: true,
19+
scale: 4,
1920
})
2021
.then(function (canvas) {
2122
screenshot.classList.remove('hero-bg-screenshot');

app/Front/Docs/Content/internals/05-package-development.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Package Development
44

55
Tempest comes with a handful of tools to help third-party package developers.
66

7-
## `#[DoNotDiscover]`
7+
## DoNotDiscover
88

99
Tempest has an attribute called `#[DoNotDiscover]`, which you can add on classes. Any class within your package that has this attribute won't be discovered by Tempest. You can still use that class internally, or allow you package to publish it (see [installers](#installers)).
1010

@@ -139,6 +139,32 @@ Finally, Installers will be discovered by Tempest, so you only need to implement
139139

140140
As you can see in the previous examples, `$this->publishImports()` is always called within the `install()` method. Calling this method will loop over all published files, and adjust any imports that reference to published files.
141141

142+
## Provider classes
143+
144+
Unlike Symfony or Laravel, Tempest doesn't have a dedicated "service provider" concept. Instead, you're encouraged to rely on discovery and initializers. However, there might be cases where you need to "set up a bunch of things for your package", and you need a place to put that code.
145+
146+
In order to do that, you're encouraged to simply have an event listener for the `KernelEvent::BOOTED` event. This event is triggered when Tempest's kernel has booted, but before any application code is run. It's the perfect place to hook into Tempest's internals if you need to set up stuff specifically for your package.
147+
148+
```php
149+
use Tempest\Core\KernelEvent;
150+
use Tempest\EventBus\EventHandler;
151+
152+
final readonly class MyPackageProvider
153+
{
154+
public function __construct(
155+
// You can inject any dependency you like
156+
private Container $container,
157+
) {}
158+
159+
#[EventHandler(KernelEvent::BOOTED)]
160+
public function init(): void
161+
{
162+
// Do whatever needs to be done
163+
$this->container->…
164+
}
165+
}
166+
```
167+
142168
## Testing helpers
143169

144170
Tempest provides a class called `\Tempest\Framework\Testing\IntegrationTest`. Your PHPUnit tests can extend from it. By doing so, your tests will automatically boot the framework, and have a range of helper methods available.

0 commit comments

Comments
 (0)