承接 axi/mycalendar-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

axi/mycalendar-bundle

最新稳定版本:2.2.0

Composer 安装命令:

composer require axi/mycalendar-bundle

包简介

Symfony bundle for axi/mycalendar package

README 文档

README

A Symfony bundle for axi/mycalendar package.

Installation

Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.

Applications that use Symfony Flex

Open a command console, enter your project directory and execute:

composer require axi/mycalendar-bundle

Applications that don't use Symfony Flex

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

composer require axi/mycalendar-bundle

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the config/bundles.php file of your project:

// config/bundles.php

return [
    // ...
    Axi\MyCalendarBundle\AxiMyCalendarBundle::class => ['all' => true],
];

Configuration

axi_my_calendar:
    # Select only certain recipes, use a list of FQDN recipes class names
    only_recipes:
#        - Axi\MyCalendar\Recipe\NowRecipe
#        - Axi\MyCalendar\Recipe\MillionMinutesRecipe
#        - App\NowRecipe

    # Exclude certain recipes from the provided ones, use a list of FQDN recipes class names
    except_recipes:
#        - Axi\MyCalendar\Recipe\PlanetsRevolutionsRecipe

    # Configure Recipe rendering, allowing to prevent / allow some recipes to be rendered with certain renderers
    recipe_rendering:
        # Allows only the specified renderers
        only:

        # Allows all available renderers but the ones listed here
        exclude:
            Axi\MyCalendar\Recipe\NowRecipe:
                - Axi\MyCalendar\Renderer\JsonRenderer
                - Axi\MyCalendar\Renderer\IcalRenderer

Usage

Controller

Inject Axi\MyCalendar\Service\CalendarService in your controller action and use it:

<?php
// 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();
    }
}

Add new recipes

Create a new class that extends Axi\MyCalendar\Recipe\AbstractRecipe or at least implements Axi\MyCalendar\Recipe\RecipeInterface.
It will be automaticaly added to CalendarService recipes.

<?php

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');
    }
}

but you're also welcome to propose a PR to add it to the main project: https://github.com/axi/my-calendar/pulls

统计信息

  • 总下载量: 24
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2024-11-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固