Giter Site home page Giter Site logo

lablnet / php-input-class Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 2.0 16 KB

PHP input request handler class, This package can process the current HTTP request values.

License: MIT License

PHP 100.00%
php free class input handler post get put header secured

php-input-class's Introduction

PHP input class

This package can process the current HTTP request values.

Requirement

  1. PHP
  2. Composer

Installation

Installing this package is very simple, first ensure you have the right PHP version and composer installed then in your terminal/(command prompt) run: composer require lablnet/input

Dependencies

This class use [lablnet/http-client](https://packagist.org/packages/lablnet/http-client) library.

Feature

  1. Supported method get,post,put,patch,delete,files,others.
  2. Clean input method(clean XSS attack/sanitize input).
  3. Determine whether request is ajax or not.
  4. Restore line breaks method.

Description

It can access the HTTP request values and return them in a more convenient way to the application. Currently it can check the input values when using the GET, POST, PUT, PATCH, DELETE, FILES etc parameters, filter the parameter values, check whether request is sent by a browser using AJAX, word wrap parameter values, check whether the request is a form submission, fix parameter value line breaks.

This class provide helpers functions for easily use of class.

Input

You can get input by calling input helpers or Input::input method

require_once "../vendor/autoload.php";
$username = input('username');
//in OOP style
use Lablnet\Input;
require_once "../vendor/autoload.php";
$username = Input::input('username');

Escape

You can escape input by calling escape helpers or Input::escape method

require_once "../vendor/autoload.php";
$username = escape(input('username'));
//in OOP style
use Lablnet\Input;
require_once "../vendor/autoload.php";
$username = Input::clean(Input::input('username'));

Determine whether request is ajax/xhr?

You can determine current request by calling is_ajax helpers or Input::isAjax method

require_once "../vendor/autoload.php";
if (is_ajax('name')) {
	//ajax
}
//in OOP style
use Lablnet\Input;
require_once "../vendor/autoload.php";
if (Input::isAjax('name')) {
	//ajax
}

Restore line breaks

You can restore line breaks by calling restore_line_break helpers or Input::restoreLineBreaks method

require_once "../vendor/autoload.php";
$comment = restore_line_break(escape(input('username')));
//in OOP style
use Lablnet\Input;
require_once "../vendor/autoload.php";
$comment = Input::restoreLineBreaks(Input::clean(Input::input('username')));

php-input-class's People

Contributors

lablnet avatar ossamamehmood avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.