jchr86/calendr

面向对象的日历管理

2.1.4 2020-03-22 21:36 UTC

README

Build Status Scrutinizer Code Quality Code Coverage SensioLabsInsight

CalendR 是一个基于 PHP5.3+ 日期对象的面向对象日历管理库。您可以使用它来处理所有关于日历和事件的需求。

完整文档

完整文档可在 此处 查找。

安装

CalendR 存放在 packagist 上,您可以使用 composer 进行安装。

打开命令行控制台,进入您的项目目录并执行

$ composer require jchr86/calendr

使用 Symfony Flex 的应用程序

启用 Bundle。

通过将其添加到项目 config/bundles.php 文件中注册的 Bundle 列表来启用 Bundle。

// config/bundles.php

return [
    // ...
    CalendR\Bridge\Symfony\Bundle\CalendRBundle::class => ['all' => true],
];

注册一个事件提供者。

// src/Repository/EventRepository.php

namespace App\Repository;

use App\Entity\Event;
use CalendR\Bridge\Doctrine\ORM\EventRepository;
use CalendR\Event\Provider\ProviderInterface;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\ORM\Query\Expr;

class EventRepository extends ServiceEntityRepository implements ProviderInterface
{
    use EventRepository;

    public function __construct(ManagerRegistry $registry)
    {
        parent::__construct($registry, Event::class);
    }
}
// config/services.yaml

services:
    App\Repository\EventRepository:
        tags:
            - { name: calendr.event_provider }

贡献

日历库欢迎贡献。合并延迟可能因我的空闲时间而异,但总是欢迎。

许可证

CalendR 采用 MIT 许可证授权 - 详细信息请参阅 LICENSE 文件。