library external-call-blocker
External Call Blocker
lcfumes/external-call-blocker
External Call Blocker
- Wednesday, September 16, 2015
- by lcfumes
- Repository
- 1 Watchers
- 0 Stars
- 0 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 2 Forks
- 0 Open issues
- 1 Versions
- 0 % Grown
External Call Blocker Library
, (*1)
Instalation
The package is available on Packagist.
Autoloading is PSR-4 compatible., (*2)
{
"require": {
"lcfumes/external-call-blocker": "dev-master"
}
}
## Usage
##### Allowing calls
use app\Blocker;
$domains = [".fumes.com.br", ".pedalize.com.br"];
$_SERVER["HTTP_REFERER"] = "http://www.fumes.com.br";
$blocker = new Blocker\Request($domains);
$request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
$blocker->isAllowed($request); // TRUE
##### Blocking external calls
use app\Blocker;
$domains = [".fumes.com.br", ".pedalize.com.br"];
$_SERVER["HTTP_REFERER"] = "http://www.anotherurl.com.br/";
$blocker = new Blocker\Request($domains);
$request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
$blocker->isAllowed($request); // FALSE
// create and send a HTTP Response with 412 Status Code - Pre Conditional Failed
$blocker->block();
License
MIT License, (*3)
dev-master
9999999-dev
External Call Blocker
Sources
Download
MIT
The Requires
The Development Requires
by
Luiz Fumes
domain
ajax
http
post
get
blocker