2017 © Pedro Peláez
 

library http

Http Lib

image

flatphp/http

Http Lib

  • Sunday, September 4, 2016
  • by fredyang
  • Repository
  • 1 Watchers
  • 1 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Http

Http Lib., (*1)

Installation

composer require "flatphp/http"

Request

use Flatphp\Http\Request;
$username = Request::get('username');
$hello = Request::post('hello', 'world');
$sanitized = Request::get('test', '', FILTER_SANITIZE_ENCODED, FILTER_FLAG_ENCODE_LOW);

Input

use Flatphp\Http\Input;
class LoginInput extends Input
{
    protected function _sanitize()
    {
        return array(
        'username' => trim($this->raw('username'))
    );
    }

    protected function _validate(&$message = '')
    {
        if (empty($this->raw('username')) || empty($this->raw('password'))) {
        $message = 'please input username and password';
        return false;
    }
    return true;
    }
}

$login_input = new LoginInput();
if ($login_input->isValid()) {
    // do login
} else {
    echo $login_input->getMessage();
}

The Versions

04/09 2016

dev-master

9999999-dev

Http Lib

  Sources   Download

MIT

The Requires

  • php >=5.5

 

by Fred Yang

http