- FEATURES
- Autoload
- Class Reflection
- Magic Methods
- Exceptions
- Late Static Binding
- Type Hinting
- SPL
- PHPUNIT
- PHAR
- COMPOSER
- Carbon
- Guzzle
- Faker
- Math
-
Requests
- DESIGN PATTERNS
- Singleton Pattern
- Observer Pattern
- Strategy Pattern
- Dependency Injection
- Middleware
- Registry
- SYMFONY
- Routes
- Annotations
- Flex
- Controllers
- Doctrine
- Templating
- VERSIONS
- Php7.4
- Php8.0
- SECURITY
- Filter Input
- Remote Code Injection
- Sql Injection
- Session Fixation
- File Uploads
- Cross Site Scripting
- Spoofed Forms
- CSRF
- Session Hijacking
- MODERN PHP
- Composer
- Autoloader
- Package
- Releases
- Generators
- Dependency Injection
- Middleware
- CUSTOM FRAMEWORK
- App
- Http Foundation
- Front Controller
- Routing
- Render Controller
- Resolver
- SoC
- FRAMEWORKS
- Slim
- Symfony V5
- Laravel V8
- Laminas V3
- Codeigniter V4
Requests
Requests is a HTTP library written in PHP (based on the API from the excellent Python library). Other HTTP libraries optimize for the library developer’s time, requests optimizes for your time. composer require rmccue/requests
require_once __DIR__ . '/vendor/autoload.php';
use WpOrg\Requests\Requests;
$url = 'http://httpbin.org/get';
$headers = ['Accept' => 'Application/json'];
$options = ['auth' => ['user', 'pass']];
// Request
$request = Requests::get($url, $headers, $options);
$body = json_decode($request->body);
// Output
echo "Status code: {$request->status_code} \r\n";
echo "Contend type: {$request->headers['content-type']} \r\n";
echo "Origin: {$body->origin} \r\n";
echo "Host: {$body->headers->Host}";
/*
Status code: 200
Contend type: application/json
Origin: 188.25.141.235
Host: httpbin.org
*/
Last update: 416 days ago