GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - brainbits/blocking: The Blocking Component provides methods to manage content based blocking.

BranchesTags
Open more actions menu

Latest commit

 

History

99 Commits
99 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
.releaserc
.releaserc
 
 
CHANGELOG
CHANGELOG
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
composer.json
composer.json
 
 
phpcs.xml.dist
phpcs.xml.dist
 
 
phpstan.neon.dist
phpstan.neon.dist
 
 
phpunit.xml.dist
phpunit.xml.dist
 
 
phpunit.xml.dist.bak
phpunit.xml.dist.bak
 
 
renovate.json
renovate.json
 
 

Repository files navigation

Blocking Component

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.

About

The Blocking Component provides methods to manage content based blocking.

Resources

Readme
MIT license
Activity
Custom properties

Stars

0 stars

Watchers

4 watching

Forks

6 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.