Download the PHP package ehsandevs/service-proxy without Composer

On this page you can find all versions of the php package ehsandevs/service-proxy. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package service-proxy

Service Proxy

Internal communication between services with useful tools
Make request by laravel http client

Installation

Publish config

Add services

Add your project's base url and global headers in proxy.php config

Usage

Normal usage

Using http request

Proxy events

On success

On error

On data success

On data collection success

Proxy response methods

Method Description
data() given data
items() give items
count() given items count
errors() given errors if there is
message() given message
onSuccess($closure) When http request is successful
onError($closure) When http request is with error
onCollectionSuccess($closure) Get collection when http request is successful
onDataSuccess($closure) Get data when http request is successful
throw() Throw error if http request failed
toException() Get exception if http request failed

Proxy request methods

Method Return Type
fake($callback = null) \Illuminate\Http\Client\Factory
accept(string $contentType) \Ehsandevs\ServiceProxy\Http
acceptJson() \Ehsandevs\ServiceProxy\Http
asForm() \Ehsandevs\ServiceProxy\Http
asJson() \Ehsandevs\ServiceProxy\Http
asMultipart() \Ehsandevs\ServiceProxy\Http
async() \Ehsandevs\ServiceProxy\Http
attach(string array $name, string $contents = '', string null $filename = null, array $headers = []) \Ehsandevs\ServiceProxy\Http
baseUrl(string $url) \Ehsandevs\ServiceProxy\Http
beforeSending(callable $callback) \Ehsandevs\ServiceProxy\Http
bodyFormat(string $format) \Ehsandevs\ServiceProxy\Http
contentType(string $contentType) \Ehsandevs\ServiceProxy\Http
dd() \Ehsandevs\ServiceProxy\Http
dump() \Ehsandevs\ServiceProxy\Http
retry(int $times, int $sleep = 0) \Ehsandevs\ServiceProxy\Http
sink(string resource $to) \Ehsandevs\ServiceProxy\Http
stub(callable $callback) \Ehsandevs\ServiceProxy\Http
timeout(int $seconds) \Ehsandevs\ServiceProxy\Http
withBasicAuth(string $username, string $password) \Ehsandevs\ServiceProxy\Http
withBody(resource string $content, string $contentType) \Ehsandevs\ServiceProxy\Http
withCookies(array $cookies, string $domain) \Ehsandevs\ServiceProxy\Http
withDigestAuth(string $username, string $password) \Ehsandevs\ServiceProxy\Http
withHeaders(array $headers) \Ehsandevs\ServiceProxy\Http
withMiddleware(callable $middleware) \Ehsandevs\ServiceProxy\Http
withOptions(array $options) \Ehsandevs\ServiceProxy\Http
withToken(string $token, string $type = 'Bearer') \Ehsandevs\ServiceProxy\Http
withUserAgent(string $userAgent) \Ehsandevs\ServiceProxy\Http
withoutRedirecting() \Ehsandevs\ServiceProxy\Http
withoutVerifying() \Ehsandevs\ServiceProxy\Http
pool(callable $callback) array
request(Request $request, string $service) \Ehsandevs\ServiceProxy\Responses\ProxyResponse
get(string $url, array string null $query = null) \Ehsandevs\ServiceProxy\Responses\ProxyResponse
delete(string $url, array $data = []) \Ehsandevs\ServiceProxy\Responses\ProxyResponse
head(string $url, array string null $query = null) \Ehsandevs\ServiceProxy\Responses\ProxyResponse
patch(string $url, array $data = []) \Ehsandevs\ServiceProxy\Responses\ProxyResponse
post(string $url, array $data = []) \Ehsandevs\ServiceProxy\Responses\ProxyResponse
put(string $url, array $data = []) \Ehsandevs\ServiceProxy\Responses\ProxyResponse
send(string $method, string $url, array $options = []) \Ehsandevs\ServiceProxy\Responses\ProxyResponse
fakeSequence(string $urlPattern = '*') \Illuminate\Http\Client\ResponseSequence
assertSent(callable $callback) void
assertNotSent(callable $callback) void
assertNothingSent() void
assertSentCount(int $count) void
assertSequencesAreEmpty() void

Mocking proxy response

You can use mock() on Proxy class before calling http methods and pass the json path in your 'tests/mock' directory, to mock a json for faking your Proxy response in test mode. Example:


All versions of service-proxy with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.3
ext-json Version *
laravel/framework Version ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
guzzlehttp/guzzle Version ^7.0
ehsandevs/bresources Version ^1.5 || ^2.2 || ^2.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ehsandevs/service-proxy contains the following files

Loading the files please wait ....