refactor: update facade structure and add service providers for logging and Redis #4

Merged
rrise merged 4 commits from feat/update-service-providers into master 2025-10-15 15:39:27 +00:00
2 changed files with 8 additions and 6 deletions
Showing only changes of commit 365ce55052 - Show all commits

View File

@@ -4,11 +4,11 @@ use Siteworxpro\App\Server;
require __DIR__ . '/vendor/autoload.php';
try {
// Instantiate the ExternalServer class
$server = new Server();
// Start the server
try {
$server->startServer();
} catch (JsonException $e) {
echo $e->getMessage();

View File

@@ -10,6 +10,7 @@ use League\Route\Http\Exception\MethodNotAllowedException;
use League\Route\Http\Exception\NotFoundException;
use League\Route\Router;
use Nyholm\Psr7\Factory\Psr17Factory;
use Siteworx\Config\Config as SWConfig;
use Siteworxpro\App\Controllers\IndexController;
use Siteworxpro\App\Http\JsonResponseFactory;
use Siteworxpro\App\Http\Middleware\CorsMiddleware;
@@ -52,6 +53,7 @@ class Server
* Server constructor.
*
* Initializes the server by booting the PSR-7 worker and router.
* @throws \ReflectionException
*/
public function __construct()
{
@@ -74,8 +76,8 @@ class Server
Facade::setFacadeContainer($container);
// Bind the container to the Config facade first so that it can be used by service providers
$container->bind(\Siteworx\Config\Config::class, function () {
return \Siteworx\Config\Config::load(__DIR__ . '/../config.php');
$container->bind(SWConfig::class, function () {
return SWConfig::load(__DIR__ . '/../config.php');
});
foreach (self::$serviceProviders as $serviceProvider) {