PHP code example of harkalygergo / symfony-platform

1. Go to this page and download the library: Download harkalygergo/symfony-platform library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

harkalygergo / symfony-platform example snippets


namespace App\Controller;

use HarkalyGergo\SymfonyPlatform\Controller\PopupController;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;

class PlatformController extends AbstractController
{

    #[Route('/{_locale?}/{path}', name: 'proxy', rget controller and action exist
        $controllerClass = 'HarkalyGergo\\SymfonyPlatform\\Controller\\' . $controllerName;
        if (!class_exists($controllerClass)) {
            return new Response('Controller not found', 404);
        }

        $controller = new $controllerClass();
        if (!method_exists($controller, $actionName)) {
            return new Response('Action not found', 404);
        }

        // Call the target action with the request
        return call_user_func_array([$controller, $actionName], [$request]);
    }
}