Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/00f100/fcphp-shttp

Package to security http requests
https://github.com/00f100/fcphp-shttp

fcphp php7 shttp

Last synced: about 2 months ago
JSON representation

Package to security http requests

Awesome Lists containing this project

README

        

# FcPhp Security HTTP

Library to manipulate auth of user into HTTP env

[![Build Status](https://travis-ci.org/00F100/fcphp-shttp.svg?branch=master)](https://travis-ci.org/00F100/fcphp-shttp) [![codecov](https://codecov.io/gh/00F100/fcphp-shttp/branch/master/graph/badge.svg)](https://codecov.io/gh/00F100/fcphp-shttp) [![Total Downloads](https://poser.pugx.org/00F100/fcphp-shttp/downloads)](https://packagist.org/packages/00F100/fcphp-shttp)

## How to install

Composer:
```sh
$ composer require 00f100/fcphp-shttp
```

or add in composer.json
```json
{
"require": {
"00f100/fcphp-shttp": "*"
}
}
```

## How to use

```php
callback('authHeaderCallback', function(ISEntity $entity, $authHeader) {
$entity->setName('Header Auth');
return $entity;
});

$instance->callback('authSessionCallback', function(ISEntity $entity, $authSession) {
$entity->setName('Session Auth');
return $entity;
});

$instance->callback('authUserPassCallback', function(ISEntity $entity, $authUserPass) {
$entity->setName('User Pass Auth');
return $entity;
});

$entity = $instance->get();

// PRINT:
// IF HEADER AUTH: Header Auth
// IF SESSION AUTH: Session Auth
// IF POST AUTH: User Pass Auth
echo $entity->getName();
```