定制 chrishardie/laravel-calendar-crawler 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

chrishardie/laravel-calendar-crawler

Composer 安装命令:

composer require chrishardie/laravel-calendar-crawler

包简介

Laravel package to enable crawling web pages for event data, generating corresponding ICS feeds

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Installation

You can install the package via composer:

composer require chrishardie/laravel-calendar-crawler

You can publish and run the migrations with:

php artisan vendor:publish --provider="ChrisHardie\CalendarCrawler\CalendarCrawlerServiceProvider" --tag="calendar-crawler-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --provider="ChrisHardie\CalendarCrawler\CalendarCrawlerServiceProvider" --tag="calendar-crawler-config"

This is the contents of the published config file:

return [
    'default_update_frequency' => 720, // Refresh every 12 hours

    'calendar_name' => 'Calendar of Events',

    'calendar_description' => 'A calendar of events from various sources.',

    // Default URL of calendar ICS feed
    'stream_url' => '/calendar/calendar.ics',

    // Source-specific authentication information
    'auth' => [
        'google' => [
            'api_key' => env('GOOGLE_CAL_API_KEY'),
        ]
    ],
];

You can add a web route for a calendar ICS feed of all stored events:

Route::calendarstream();

Usage

  1. Use an admin interface, artisan tinker session, DB seeder file or direct database call to add calendar sources. The main fields needed are:
  • Name
  • Type (currently, GoogleCalendar or FacebookPage)
  • Home URL
  • Location (either the Google Calendar calendar ID or the Facebook Page's numeric page ID)
        DB::table('calendar_sources')->insert([
            'name' => 'Your Local Government',
            'type' => 'GoogleCalendar',
            'home_url' => 'https://www.government.gov/',
            'location' => 'googlecalendarid@gmail.com',
        ]);

        DB::table('calendar_sources')->insert([
            'name' => 'Cool Nonprofit Organization',
            'type' => 'FacebookPage',
            'home_url' => 'https://www.facebook.com/orgname/',
            'location' => '12345678',
        ]);
  1. If you specify any GoogleCalendar sources, you will need to create an API key and then define a GOOGLE_CAL_API_KEY with that key as the value in your .env file.
  2. The sources provided will be crawled according to the update frequency specified.
  3. Use the event data elsewhere within your Laravel application directly, or retrieve an ICS calendar feed of events at the stream_url location specified.

Crawling issues, errors and notices will be written to the log stack configured. Consider using a Slack channel for convenience.

Uninstalling

Remove any web routes created during installation.

Remove the package and any dependencies:

composer remove chrishardie/laravel-calendar-crawler

Remove config/calendar-crawler.php.

Drop the related tables in a new migration:

Schema::dropIfExists('calendar_sources');
Schema::dropIfExists('events');

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-10-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固