Recommend this page to a friend! |
Download .zip |
Info | Example | View files (18) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2023-11-30 (1 month ago) | Not yet rated by the users | Total: 44 | All time: 10,705 This week: 117 |
Version | License | PHP version | Categories | |||
request-service-php- 7.0.0 | Custom (specified... | 8.3 | HTTP, Web services, PHP 7 |
Description | Author | |
This package can send HTTP requests to Web services. |
<?php |
PHP library using Guzzle base to send request to any services. Good to use in microservice architecture
Release 7.0.0 Requires PHP 8.3
Release 6.0.0 Requires PHP 8.2
Release 5.0.0 Requires PHP 8.1
Release 4.0.0 Requires PHP 7.4
Release 3.0.0 Requires PHP 7.3
Release 2.0.0 Requires PHP 7.2
Release 1.0.0 Requires PHP 7.1
The recommended way to install is through Composer.
composer require not-empty/request-service-php-lib
Requesting json
use RequestService\Request;
$config = [
'your-service' => [
'url' => 'https://jsonplaceholder.typicode.com',
],
];
$sample = new Request($config);
$response = $sample->sendRequest(
'your-service',
'GET',
'todos/1'
);
var_dump($response);
Requesting stream
use RequestService\Request;
$config = [
'your-service' => [
'url' => 'https://developer.marvel.com/',
'json' => false,
],
];
$sample = new Request($config);
$header = [
'stream' => true,
];
$response = $sample->sendRequest(
'your-service',
'GET',
'docs',
$header
);
var_dump($response);
if you want an environment to run or test it, you can build and install dependences like this
docker build --build-arg PHP_VERSION=8.3-rc-cli -t not-empty/request-service-php-lib:php83 -f contrib/Dockerfile .
Access the container
docker run -v ${PWD}/:/var/www/html -it not-empty/request-service-php-lib:php83 bash
Verify if all dependencies is installed
composer install --no-dev --prefer-dist
and run
php sample/request-sample.php
php sample/request-image-sample.php
Want to contribute? Great!
The project using a simple code. Make a change in your file and be careful with your updates! Any new code will only be accepted with all validations.
To ensure that the entire project is fine:
First you need to building a correct environment to install all dependences
docker build --build-arg PHP_VERSION=8.3-rc-cli -t not-empty/request-service-php-lib:php83 -f contrib/Dockerfile .
Access the container
docker run -v ${PWD}/:/var/www/html -it not-empty/request-service-php-lib:php83 bash
Install all dependences
composer install --dev --prefer-dist
Run all validations
composer check
Not Empty Foundation - Free codes, full minds
Files |
File | Role | Description | ||
---|---|---|---|---|
.github (1 directory) | ||||
contrib (4 files) | ||||
sample (2 files) | ||||
src (2 files) | ||||
tests (2 files) | ||||
composer.json | Data | Auxiliary data | ||
composer.lock | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
phpcs.xml | Data | Auxiliary data | ||
phpmd.xml | Data | Auxiliary data | ||
phpunit.xml | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
Files | / | contrib |
File | Role | Description |
---|---|---|
coverage-checker.php | Example | Example script |
Dockerfile | Data | Auxiliary data |
pre-commit | Data | Auxiliary data |
setup.sh | Data | Auxiliary data |
Files | / | sample |
File | Role | Description |
---|---|---|
request-image-sample.php | Example | Example script |
request-sample.php | Example | Example script |
Files | / | tests |
File | Role | Description |
---|---|---|
BaseRequestTest.php | Class | Class source |
RequestTest.php | Class | Class source |
request-service-php--2023-11-30.zip 36KB | |
request-service-php--2023-11-30.tar.gz 33KB | |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.