alhad15/laravel-fullcalendar
Composer 安装命令:
composer require alhad15/laravel-fullcalendar
包简介
Laravel component for fullcalendar package
README 文档
README
Installation
The preferred way to install this extension is through composer.
To install, either run
$ php composer.phar require edofre/laravel-fullcalendar
or add
"edofre/laravel-fullcalendar": "V1.2.4"
to the require section of your composer.json file.
Note
The fxp/composer-asset plugin is required for this package to install properly. This plugin enables you to download bower packages through composer.
You can install it using this command:
composer global require "fxp/composer-asset-plugin:^1.4.0”
This will add the fxp composer-asset-plugin and your composer will be able to find and download the required bower-asset/fullcalendar package. You can find more info on this page: https://packagist.org/packages/fxp/composer-asset-plugin.
Configuration
Add the ServiceProvider to your config/app.php
'providers' => [ ... Edofre\Fullcalendar\FullcalendarServiceProvider::class, ],
And add the facade
'aliases' => [ ... 'Fullcalendar' => Edofre\Fullcalendar\Facades\Fullcalendar::class, ],
Publish assets and configuration files
php artisan vendor:publish --tag=config
php artisan vendor:publish --tag=fullcalendar
Manually loading script files
By setting the include_scripts option in the config/.env file to false the scripts will not be included when generating the calendar. If you want to manually include the scripts you can call the following static function in your header/footer/etc.
\Edofre\Fullcalendar\Fullcalendar::renderScriptFiles();
Example
Below is an example of a controller action configuring the calendar
public function index() { // Generate a new fullcalendar instance $calendar = new \Edofre\Fullcalendar\Fullcalendar(); // You can manually add the objects as an array $events = $this->getEvents(); $calendar->setEvents($events); // Or you can add a route and return the events using an ajax requests that returns the events as json $calendar->setEvents(route('fullcalendar-ajax-events')); // Set options $calendar->setOptions([ 'locale' => 'nl', 'weekNumbers' => true, 'selectable' => true, 'defaultView' => 'agendaWeek', // Add the callbacks 'eventClick' => new \Edofre\Fullcalendar\JsExpression(" function(event, jsEvent, view) { console.log(event); } "), 'viewRender' => new \Edofre\Fullcalendar\JsExpression(" function( view, element ) { console.log(\"View \"+view.name+\" rendered\"); } "), ]); // Check out the documentation for all the options and callbacks. // https://fullcalendar.io/docs/ return view('fullcalendar.index', [ 'calendar' => $calendar, ]); } /** * @param Request $request * @return string */ public function ajaxEvents(Request $request) { // start and end dates will be sent automatically by fullcalendar, they can be obtained using: // $request->get('start') & $request->get('end') $events = $this->getEvents(); return json_encode($events); } /** * @return array */ private function getEvents() { $events = []; $events[] = new \Edofre\Fullcalendar\Event([ 'id' => 0, 'title' => 'Rest', 'allDay' => true, 'start' => Carbon::create(2016, 11, 20), 'end' => Carbon::create(2016, 11, 20), ]); $events[] = new \Edofre\Fullcalendar\Event([ 'id' => 1, 'title' => 'Appointment #' . rand(1, 999), 'start' => Carbon::create(2016, 11, 15, 13), 'end' => Carbon::create(2016, 11, 15, 13)->addHour(2), ]); $events[] = new \Edofre\Fullcalendar\Event([ 'id' => 2, 'title' => 'Appointment #' . rand(1, 999), 'editable' => true, 'startEditable' => true, 'durationEditable' => true, 'start' => Carbon::create(2016, 11, 16, 10), 'end' => Carbon::create(2016, 11, 16, 13), ]); $events[] = new \Edofre\Fullcalendar\Event([ 'id' => 3, 'title' => 'Appointment #' . rand(1, 999), 'editable' => true, 'startEditable' => true, 'durationEditable' => true, 'start' => Carbon::create(2016, 11, 14, 9), 'end' => Carbon::create(2016, 11, 14, 10), 'backgroundColor' => 'black', 'borderColor' => 'red', 'textColor' => 'green', ]); return $events; }
You can then render the calendar by generating the HMTL and scripts
{!! $calendar->generate() !!}
Tests
Run the tests by executing the following command:
composer test
alhad15/laravel-fullcalendar 适用场景与选型建议
alhad15/laravel-fullcalendar 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 08 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「javascript」 「event」 「calendar」 「laravel」 「fullcalendar」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 alhad15/laravel-fullcalendar 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 alhad15/laravel-fullcalendar 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 alhad15/laravel-fullcalendar 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Generates a Blade directive exporting all of your named Laravel routes. Also provides a nice route() helper function in JavaScript.
Caching and compression for Twig assets (JavaScript and CSS).
A pretty nice way to expose your translation messages to your JavaScript.
A modern PHP library for generating iCalendar v2.0 events
A powerful event calendar Tool for Laravel's Nova 5.
Check for holidays - localeaware
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-08-19