PluginProbe ʕ •ᴥ•ʔ
Kirki – Freeform Page Builder, Website Builder & Customizer / 6.0.13
Kirki – Freeform Page Builder, Website Builder & Customizer v6.0.13
6.1.1 6.1.0 6.0.14 6.0.13 6.0.12 6.0.11 6.0.10 6.0.9 6.0.8 6.0.7 6.0.6 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.19 4.0.20 4.0.21 4.0.22 4.0.23 4.0.24 4.1 4.2.0 5.0.0 5.1.0 5.1.1 5.2.0 5.2.1 5.2.2 5.2.3 6.0.0 trunk 3.0.40 3.0.41 3.0.42 3.0.43 3.0.44 3.0.45 3.1.0 3.1.1 3.1.2
kirki / libraries / framework / CoreServiceProvider.php
kirki / libraries / framework Last commit date
Collections 3 weeks ago Concerns 3 weeks ago Console 3 weeks ago Constants 3 weeks ago Contracts 3 weeks ago Database 3 weeks ago Discovery 3 weeks ago Exceptions 3 weeks ago Filesystem 3 weeks ago Http 3 weeks ago Managers 3 weeks ago Middlewares 3 weeks ago Polyfill 3 weeks ago Supports 3 weeks ago Validation 3 weeks ago Wordpress 3 weeks ago ApiExceptionHandler.php 3 weeks ago Application.php 3 weeks ago Container.php 3 weeks ago CoreServiceProvider.php 3 weeks ago DTO.php 3 weeks ago Facade.php 3 weeks ago Listener.php 3 weeks ago Resource.php 3 weeks ago Route.php 3 weeks ago Sanitizer.php 3 weeks ago ServiceProvider.php 3 weeks ago helpers.php 3 weeks ago
CoreServiceProvider.php
137 lines
1 <?php
2
3 /**
4 * Registers the framework's essential services during application bootstrap.
5 * Binds database, schema, migration, discovery, and manager components into the container.
6 * Boots listener and policy discovery caching.
7 *
8 * @package Framework
9 * @since 1.0.0
10 */
11 namespace Kirki\Framework;
12
13 \defined('ABSPATH') || exit;
14 use Kirki\Framework\Console\CommandManager;
15 use Kirki\Framework\Database\Connection\Connection;
16 use Kirki\Framework\Database\Connection\DatabaseManager;
17 use Kirki\Framework\Database\Migrations\Migrator;
18 use Kirki\Framework\Database\Schema\SchemaManager;
19 use Kirki\Framework\Discovery\ListenerDiscovery;
20 use Kirki\Framework\Discovery\PolicyDiscovery;
21 use Kirki\Framework\Managers\EventManager;
22 use Kirki\Framework\Managers\LogManager;
23 use Kirki\Framework\Managers\PolicyManager;
24 use Kirki\Framework\ServiceProvider;
25 use Kirki\Framework\Managers\DateManager;
26 use Kirki\Framework\Http\Response;
27 use Kirki\Framework\Supports\MessagesBag;
28 class CoreServiceProvider extends ServiceProvider
29 {
30 /**
31 * Register the hooks to the application.
32 *
33 * @return void
34 *
35 * @since 1.0.0
36 */
37 public function register()
38 {
39 $this->register_database_services();
40 $this->register_discoveries();
41 $this->register_managers();
42 $this->register_migrations();
43 $this->register_messages();
44 $this->app->singleton(Response::class);
45 if (\class_exists(\Faker\Factory::class)) {
46 $this->app->singleton(\Faker\Factory::class, function () {
47 return \Faker\Factory::create();
48 });
49 }
50 }
51 /**
52 * Boot the service provider.
53 *
54 * @return void
55 *
56 * @since 1.0.0
57 */
58 public function boot()
59 {
60 $this->app->make(PolicyDiscovery::class)->discover()->cache();
61 $this->app->make(ListenerDiscovery::class)->discover()->cache();
62 }
63 /**
64 * Register the messages.
65 *
66 * @return void
67 *
68 * @since 1.0.0
69 */
70 protected function register_messages()
71 {
72 $this->app->singleton(MessagesBag::class, function () {
73 return new MessagesBag();
74 });
75 }
76 /**
77 * Register the managers.
78 *
79 * @return void
80 *
81 * @since 1.0.0
82 */
83 protected function register_managers()
84 {
85 $this->app->singleton(DatabaseManager::class);
86 $this->app->singleton(SchemaManager::class);
87 $this->app->singleton(LogManager::class);
88 $this->app->singleton(EventManager::class);
89 $this->app->singleton(PolicyManager::class);
90 $this->app->singleton(DateManager::class);
91 $this->app->singleton(CommandManager::class);
92 }
93 /**
94 * Register the discoveries.
95 *
96 * @return void
97 *
98 * @since 1.0.0
99 */
100 protected function register_discoveries()
101 {
102 $this->app->singleton(ListenerDiscovery::class);
103 $this->app->singleton(PolicyDiscovery::class);
104 }
105 /**
106 * Register the database singletons.
107 *
108 * @return void
109 *
110 * @since 1.0.0
111 */
112 protected function register_database_services()
113 {
114 $this->app->singleton(Connection::class);
115 $this->app->singleton(Migrator::class);
116 }
117 /**
118 * Register the migrations tags.
119 *
120 * @return void
121 *
122 * @since 1.0.0
123 */
124 protected function register_migrations()
125 {
126 $migrations_path = $this->app->config_path('migrations.php');
127 if (!\file_exists($migrations_path)) {
128 return;
129 }
130 $migrations = (include $migrations_path);
131 if (empty($migrations)) {
132 return;
133 }
134 $this->app->tag($migrations, 'app.migrations');
135 }
136 }
137