PHP code example of iwf-web / json-request-check-bundle
1. Go to this page and download the library: Download iwf-web/json-request-check-bundle 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/ */
iwf-web / json-request-check-bundle example snippets
namespace App\Controller\Api;
use IWF\JsonRequestCheckBundle\Attribute\JsonRequestCheck;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Attribute\Route;
class ApiController extends AbstractController
{
#[Route('/api/endpoint', methods: [Request::METHOD_POST])]
#[JsonRequestCheck(maxJsonContentSize: 1024)] // Limits to 1KB for this route
public function apiEndpoint(Request $request): object
{
// Your code here...
return $this->json(['status' => 'success']);
}
}