You've already forked Php-Template
refactor: update facade structure and add service providers for logging and Redis #4
@@ -4,11 +4,11 @@ use Siteworxpro\App\Server;
|
|||||||
|
|
||||||
require __DIR__ . '/vendor/autoload.php';
|
require __DIR__ . '/vendor/autoload.php';
|
||||||
|
|
||||||
// Instantiate the ExternalServer class
|
|
||||||
$server = new Server();
|
|
||||||
|
|
||||||
// Start the server
|
|
||||||
try {
|
try {
|
||||||
|
// Instantiate the ExternalServer class
|
||||||
|
$server = new Server();
|
||||||
|
|
||||||
|
// Start the server
|
||||||
$server->startServer();
|
$server->startServer();
|
||||||
} catch (JsonException $e) {
|
} catch (JsonException $e) {
|
||||||
echo $e->getMessage();
|
echo $e->getMessage();
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use League\Route\Http\Exception\MethodNotAllowedException;
|
|||||||
use League\Route\Http\Exception\NotFoundException;
|
use League\Route\Http\Exception\NotFoundException;
|
||||||
use League\Route\Router;
|
use League\Route\Router;
|
||||||
use Nyholm\Psr7\Factory\Psr17Factory;
|
use Nyholm\Psr7\Factory\Psr17Factory;
|
||||||
|
use Siteworx\Config\Config as SWConfig;
|
||||||
use Siteworxpro\App\Controllers\IndexController;
|
use Siteworxpro\App\Controllers\IndexController;
|
||||||
use Siteworxpro\App\Http\JsonResponseFactory;
|
use Siteworxpro\App\Http\JsonResponseFactory;
|
||||||
use Siteworxpro\App\Http\Middleware\CorsMiddleware;
|
use Siteworxpro\App\Http\Middleware\CorsMiddleware;
|
||||||
@@ -52,6 +53,7 @@ class Server
|
|||||||
* Server constructor.
|
* Server constructor.
|
||||||
*
|
*
|
||||||
* Initializes the server by booting the PSR-7 worker and router.
|
* Initializes the server by booting the PSR-7 worker and router.
|
||||||
|
* @throws \ReflectionException
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@@ -74,8 +76,8 @@ class Server
|
|||||||
Facade::setFacadeContainer($container);
|
Facade::setFacadeContainer($container);
|
||||||
|
|
||||||
// Bind the container to the Config facade first so that it can be used by service providers
|
// Bind the container to the Config facade first so that it can be used by service providers
|
||||||
$container->bind(\Siteworx\Config\Config::class, function () {
|
$container->bind(SWConfig::class, function () {
|
||||||
return \Siteworx\Config\Config::load(__DIR__ . '/../config.php');
|
return SWConfig::load(__DIR__ . '/../config.php');
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (self::$serviceProviders as $serviceProvider) {
|
foreach (self::$serviceProviders as $serviceProvider) {
|
||||||
|
|||||||
Reference in New Issue
Block a user