1. Go to this page and download the library: Download jul6art/core-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/ */
// rendering the form
return $this->render('security/register.html.twig', [
'captchaQuestion' => $this->captcha->generate(), // "3 + 5"
]);
// handling the submission
if (!$this->captcha->validate($request->request->getString('captcha'))) {
// refuse, and call generate() again for the next attempt
}
use Jul6Art\CoreBundle\Attribute\Purgeable;
#[Purgeable(field: 'createdAt', interval: '-3 months')]
#[Purgeable(field: 'deletedAt', interval: '-1 week', condition: 'entity.isDeleted()')]
class AuditLog { … }
#[AsEventListener(event: EntityPurgedEvent::NAME)]
public function onEntityPurged(EntityPurgedEvent $event): void
{
$this->auditLogger->log('entity.purged', $event->getOrganizationId(), null,
$event->getEntityShortName(), $event->getEntityId());
}
final class JsTranslationTest extends AbstractJsTranslationTestCase
{
protected static function javaScriptDirectories(): array
{
return [
self::projectDir().'/assets',
// ⚠️ The bundles too: their controllers read keys THIS catalogue must hold.
self::projectDir().'/vendor/jul6art/datatable-bundle/assets',
];
}
// Keys no scanner can see — an enum read as `t(`datatable.work_order_status.${value}`)`.
protected static function declaredKeys(): array
{
return array_map(static fn (WorkOrderStatus $c): string => $c->translationKey(), WorkOrderStatus::cases());
}
// A weaker promise: alive, but not
$this->getCurrentUserOrNull(); // ?UserInterface
$this->getCurrentUserIdOrNull(); // ?int — the account the request runs as
$this->getOriginalUserIdOrNull(); // ?int — the account that started an impersonation
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
class Page
{
use IdTrait;
use SoftDeletableTrait;
use TimestampableTrait;
}
final class UserController extends AbstractController
{
public function edit(Request $request, User $user): Response
{
// …
return $this->redirectBackWithSuccess($request, 'user.updated', 'user_index');
}
}
final class ProfileController extends AbstractController
{
protected function translationDomain(): string
{
return 'profile'; // flashes, form errors and trans() alike
}
public function edit(Request $request): Response
{
// …
return $this->redirectWithSuccess('profile_show', 'edit.success'); // → domain 'profile'
}
}