Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

00f100/fcphp-request

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

00f100/fcphp-request

Package to manage requests

Source
Packagist
Version
dev-master
Version published
Maintainers
1
Created
Source

FcPhp Request

Package to manage requests

Build Status codecov Total Downloads

How to install

Composer:

$ composer require 00f100/fcphp-request

or add in composer.json

{
    "require": {
        "00f100/fcphp-request": "*"
    }
}

How to use

<?php

use FcPhp\Request\Request;

$request = new Request($_SERVER);

if($request->isConsole()) {
    /*

    Console Request


    $request->console = [
        'path' => $_SERVER['PWD'],
        'script-name' => $_SERVER['SCRIPT_NAME'],
        'home' => $_SERVER['HOME'],
        'lang' => $_SERVER['LANG'],
        'shell' => $_SERVER['SHELL'],
        'user' => $_SERVER['USER'],
        'username' => $_SERVER['USERNAME'],
        'params' => $_SERVER['argv'],
    ];
    */
    // Print: $request->console['path'] => $_SERVER['PWD']
    echo $request->get('path');

} else {
    /*

    Web Request


    $request->http = [
        'path' => $_SERVER['DOCUMENT_ROOT'],
        'script-name' => $_SERVER['SCRIPT_NAME'],
        'ip-client' => $_SERVER['REMOTE_ADDR'],
        'software' => $_SERVER['SERVER_SOFTWARE'],
        'server-name' => $_SERVER['SERVER_NAME'],
        'method' => $_SERVER['REQUEST_METHOD'],
        'host' => $_SERVER['HTTP_HOST'],
        'port' => $_SERVER['SERVER_PORT'],
        'uri' => $_SERVER['REQUEST_URI'],
        'user-agent' => $_SERVER['HTTP_USER_AGENT'],
        'content-type' => $_SERVER['HTTP_CONTENT_TYPE'],
        'query' => [],
        'headers' => [],
    ];
    */
    // Print: $request->http['method'] => $_SERVER['REQUEST_METHOD']
    echo $request->get('method');
}

FAQs

Package last updated on 04 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts