1. Go to this page and download the library: Download axi/mycalendar-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/ */
// src/Controller/MyController.php
namespace App;
use Axi\MyCalendar\Service\CalendarService;
use DateTimeImmutable;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class MyController extends AbstractController {
#[Route(
path: /events
)]
public function eventsDate(
CalendarService $calendarService
): Response {
$birthdate = new DateTimeImmutable('1984-01-12');
$events = $calendarService->getEvents($birthdate);
dump($events);
return new Response();
}
}
namespace App;
use Axi\MyCalendar\Recipe\AbstractRecipe;
use Axi\MyCalendar\Event;
use Symfony\Component\Translation\TranslatableMessage;
class NowRecipe extends AbstractRecipe
{
public function getEvents(\DateTimeImmutable $basedOn): array
{
$event = new Event(
new \DateTimeImmutable()
);
$event->setSummary(new TranslatableMessage('Now'));
$event->setSourceRecipe(self::class);
return [$event];
}
public function getSummary(...$vars): TranslatableMessage
{
return new TranslatableMessage('Now');
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.