actengage/night-watch 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

actengage/night-watch

Composer 安装命令:

composer require actengage/night-watch

包简介

The official Laravel package for the NightWatch service.

README 文档

README

PHP Composer

What is NightWatch?

NightWatch is a package that watches URL's while you are away or sleeping. NightWatch uses a remote Node server to check the status of remote URL's. For example, NightWatch can heck for 404 URLs, or if a Google Tag Manager has been installed correctly.

What is included in this package?

This package has its own factories, migrations, models, and scheduling to make tracking status of remote URL's and services easy and configurable.

Installation

composer require actengage/night-watch

php artisan vendor:publish

Configure the ENV

This is a private application currently, and thus the API endpoint is not included. Include the endpoint in your ENV file.

NIGHTWATCH_ENDPOINT_URI='https://the.night.watch.url.goes.here'

Kernel Scheduling

NightWatch makes it easy to schedule the commands. Once you have ran the migrations, add the following 1-liner to app/Console/Kernel.php.

<?php

namespace App\Console;

use Actengage\NightWatch\Watcher;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        Watcher::schedule($schedule);
    }
}

Basic Example

Manually start a watcher to check Google's homepage every hour.

use \Actengage\NightWatch\Watcher;

Watcher::create([
    'url' => 'https://google.com',
    'schedule' => ['hourly']
]);

Using the Watchable Trait

You can easily relate Watchers to your models.

use Actengage\NightWatch\Watchable;
use Actengage\NightWatch\Watcher;
use Illuminate\Database\Eloquent\Model;

class Url extends Model {
    use Watchable;
    
    protected $fillable = ['url'];

    public static function boot()
    {
        parent::boot();

        static::created(function($model) {
            $watcher = Watcher::create([
                'url' => $model->url
            ]);

            // This is a many to many relationship provided by the trait.
            $model->watchers()->attach($watcher);
        });
    }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: proprietary
  • 更新时间: 2020-07-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固