1. Go to this page and download the library: Download depthbomb/csrf-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/ */
depthbomb / csrf-bundle example snippets
return [
// Your other bundles...
Depthbomb\CsrfBundle\CsrfBundle::class => ['all' => true],
];
namespace App\Controller;
use Depthbomb\CsrfBundle\Attribute\CsrfProtected;
use Symfony\Component\HttpFoundation\Response;
class ProfileController
{
#[CsrfProtected('update-profile')]
public function update(): Response
{
// Update the profile after the token check succeeds.
return new Response('Profile updated');
}
}