Download the PHP package xpat/xpat-http without Composer
On this page you can find all versions of the php package xpat/xpat-http. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package xpat-http
Simple Object-Oriented HTTP Client
A simple and intuitive object-oriented HTTP client for PHP. This library enables you to make HTTP requests (GET, POST, PUT, DELETE) with clean, structured code.
Features
- Object-oriented design.
- Supports common HTTP methods: GET, POST, PUT, DELETE.
- Easily configurable headers and request body.
- Straightforward and reusable components for URL, headers, and body.
Installation
Usage
GET Request Example
POST Request Example
PUT Request Example
DELETE Request Example
Components
Url
Defines the request URL, including the host, port, and endpoint.
Headers
Manages HTTP headers as key-value pairs.
JsonBody
Formats and encapsulates the request body as JSON.
Response Object
The execute()
method returns a response object with the following methods:
content()
: The content of the HTTP response.statusCode()
: The HTTP status code of the response.
JsonObject
The JsonObject class provides a simple and powerful way to work with JSON data in an object-oriented manner. It allows you to parse, query, and manipulate JSON structures using a key-path syntax.
Example
License
The MIT License (MIT)
Copyright (c) 2024 Alymbek Kydyrmyshev
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
All versions of xpat-http with dependencies
ext-curl Version *