lcfumes / external-call-blocker
External Call Blocker
dev-master
2015-09-16 18:10 UTC
Requires
- symfony/http-foundation: 2.7.4
Requires (Dev)
- fabpot/php-cs-fixer: ^1.10
- mayflower/php-codebrowser: 1.1.*
- pdepend/pdepend: 2.0.*
- phpdocumentor/phpdocumentor: 2.8.*
- phploc/phploc: 2.1.*
- phpmd/phpmd: 2.2.*
- phpunit/phpunit: 4.5.*
- sebastian/phpcpd: 2.0.*
- squizlabs/php_codesniffer: 2.3.*
This package is auto-updated.
Last update: 2024-12-15 05:41:45 UTC
README
Instalation
The package is available on Packagist. Autoloading is PSR-4 compatible.
{ "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