Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
"phpdocumentor/reflection-docblock": "6.*",
"phpunit/phpunit": "^12.3",
"rector/rector": "^2",
"symfony/browser-kit": "^8.0",
"symfony/css-selector": "^8.0",
"symfony/yaml": "8.*",
"zircote/swagger-php": "^6.0"
},
Expand Down
213 changes: 212 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 9 additions & 24 deletions phpmyfaq/admin/api/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@
* @since 2023-07-02
*/

use phpMyFAQ\Application;
use phpMyFAQ\Core\Exception\DatabaseConnectionException;
use phpMyFAQ\Environment;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use phpMyFAQ\Kernel;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

try {
Expand All @@ -49,24 +47,11 @@
exit(1);
}

//
// Service Containers
//
$container = new ContainerBuilder();
$loader = new PhpFileLoader($container, new FileLocator(__DIR__));
try {
$loader->load('../../src/services.php');
} catch (Exception $exception) {
echo sprintf('Error: %s at line %d at %s', $exception->getMessage(), $exception->getLine(), $exception->getFile());
}
$kernel = new Kernel(
routingContext: 'admin-api',
debug: Environment::isDebugMode(),
);

$app = new Application($container);
$app->setAdminContext(true);
$app->setApiContext(true);
$app->routingContext = 'admin-api';
try {
// Autoload routes from attributes (falls back to api-routes.php during migration)
$app->run();
} catch (Exception $exception) {
echo sprintf('Error: %s at line %d at %s', $exception->getMessage(), $exception->getLine(), $exception->getFile());
}
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
31 changes: 9 additions & 22 deletions phpmyfaq/admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@
* @since 2002-09-16
*/

use phpMyFAQ\Application;
use phpMyFAQ\Controller\Frontend\ErrorController;
use phpMyFAQ\Core\Exception\DatabaseConnectionException;
use phpMyFAQ\Environment;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use phpMyFAQ\Kernel;
use Symfony\Component\HttpFoundation\Request;

try {
require dirname(__DIR__) . '/src/Bootstrap.php';
Expand All @@ -36,22 +34,11 @@
exit(1);
}

//
// Service Containers
//
$container = new ContainerBuilder();
$loader = new PhpFileLoader($container, new FileLocator(__DIR__));
try {
$loader->load('../src/services.php');
} catch (Exception $exception) {
echo sprintf('Error: %s at line %d at %s', $exception->getMessage(), $exception->getLine(), $exception->getFile());
}
$kernel = new Kernel(
routingContext: 'admin',
debug: Environment::isDebugMode(),
);

$app = new Application($container);
$app->routingContext = 'admin';
try {
// Auto-loads routes from attributes (falls back to admin-routes.php during migration)
$app->run();
} catch (Exception $exception) {
echo sprintf('Error: %s at line %d at %s', $exception->getMessage(), $exception->getLine(), $exception->getFile());
}
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
32 changes: 9 additions & 23 deletions phpmyfaq/api/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@

declare(strict_types=1);

use phpMyFAQ\Application;
use phpMyFAQ\Core\Exception\DatabaseConnectionException;
use phpMyFAQ\Environment;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use phpMyFAQ\Kernel;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

try {
Expand All @@ -50,23 +48,11 @@
exit(1);
}

//
// Service Containers
//
$container = new ContainerBuilder();
$loader = new PhpFileLoader($container, new FileLocator(__DIR__));
try {
$loader->load('../src/services.php');
} catch (Exception $e) {
echo $e->getMessage();
}
$kernel = new Kernel(
routingContext: 'api',
debug: Environment::isDebugMode(),
);

$app = new Application($container);
$app->setApiContext(true);
$app->routingContext = 'api';
try {
// Autoload routes from attributes (falls back to api-routes.php during migration)
$app->run();
} catch (Exception $exception) {
echo $exception->getMessage();
}
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
Loading