-
Notifications
You must be signed in to change notification settings - Fork 3
/
bootstrap.php
46 lines (38 loc) · 1.74 KB
/
bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
declare(strict_types=1);
use Spatie\ShikiPhp\Shiki;
use Alfresco\Render\Factory;
use Alfresco\Support\Translator;
use Illuminate\Container\Container;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Translation\FileLoader;
use Illuminate\Config\Repository as Configuration;
return tap(Container::getInstance(), function (Container $container) {
$container->instance(Container::class, $container);
$container->singleton(Configuration::class, fn () => new Configuration([
'debug' => false,
'language' => 'en',
'root_directory' => __DIR__,
'build_directory' => __DIR__.'/build/output',
'cache_directory' => __DIR__.'/build/cache',
'resource_directory' => __DIR__.'/resources',
'index_directory' => __DIR__.'/build/indexes',
'component_directory' => __DIR__.'/resources/components',
'translation_directory' => __DIR__.'/resources/translations',
'replacements_directory' => __DIR__.'/resources/replacements',
]));
$container->singleton(Factory::class);
$container->bind(Shiki::class, fn (Container $container) => new Shiki(
$container->make(Configuration::class)->get('root_directory').'/theme.json',
));
$container->bind(FileLoader::class, fn (Container $container) => new FileLoader(
$container->make(Filesystem::class),
$container->make(Configuration::class)->get('translation_directory'),
));
$container->singleton(Translator::class, fn (Container $container) => (new Translator(
$container->make(FileLoader::class),
'en',
))->handleMissingKeysUsing(function ($key, $replace, $locale, $fallback) {
throw new RuntimeException("Missing translation [{$key}] for locale [{$locale}].");
}));
});