承接 brainbits/blocking 相关项目开发

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

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

brainbits/blocking

最新稳定版本:5.1.0

Composer 安装命令:

composer require brainbits/blocking

包简介

Object blocking

README 文档

README

Latest Version Software License Total Downloads Tests

The Blocking Component provides methods to manage content based blocking.

<?php

use Brainbits\Blocking\Blocker;
use Brainbits\Blocking\Identity\Identity;
use Brainbits\Blocking\Owner\SymfonySessionOwnerFactory;
use Brainbits\Blocking\Storage\FilesystemStorage;
use Brainbits\Blocking\Validator\ExpiredValidator;

$storage = new FilesystemStorage('/where/to/store/blocks' /* path to directory on filesystem */);
$ownerFactory = new SymfonySessionOwnerFactory($session /* symfony session */);
$validator = new ExpiredValidator(300 /* block will expire after 300 seconds */);

$blocker = new Blocker($storage, $ownerFactory, $validator);

$identity = new Identity('my_content_123');

$block = $blocker->block($identity);
$result = $blocker->unblock($identity);
$result = $blocker->isBlocked($identity);
$block = $blocker->getBlock($identity);

Blocking Storage

The blocking storage is used to store the block information.

A file based blocking storage is provided. It writes block-files to the filesystem, based on the blocking identifier.

Blocking Identity

The blocking identity is used to identify the content that is being blocked.

A general purpose blocking identify is provided, that uses a string as an identifier.

Blocking Owner

The blocking owner is used to identify the user that created the block.

A symfony session based owner class is provided.

Blocking Validator

The blocking validator is used to test wether or not an existing block is still valid.

A validator that checks a block via last modification time is provided.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-04-03