Download the PHP package medianet-dev/p-connector without Composer
On this page you can find all versions of the php package medianet-dev/p-connector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download medianet-dev/p-connector
More information about medianet-dev/p-connector
Files in medianet-dev/p-connector
Download medianet-dev/p-connector
More information about medianet-dev/p-connector
Files in medianet-dev/p-connector
Vendor medianet-dev
Package p-connector
Short Description Link projects together with restful apis
License MIT
Homepage https://github.com/medianet-dev/p-connector
Package p-connector
Short Description Link projects together with restful apis
License MIT
Homepage https://github.com/medianet-dev/p-connector
Keywords medianet-devp-connector
Please rate this library. Is it a good library?
Informations about the package p-connector
**PConnector** is a package that makes linking projects together much easier than performing a manual *Guzzle* or *Curl* requests. You only need to set some basic settings of your gateway(s) and that's it. ## Installation You can install the package via composer: Then migrate the package table by running: ## Usage Here we will pass through some examples of doing some basic and advanced Api calls . ### Configuring your gateway(s) Before start playing with the package you need to setup a profile for your gateway, and to do so, you need to publish the configuration file by running: After publishing the configuration, go to `p-connector.php` config file and setup you first profile setting: > Note that you can set **more than one** profile. And that's it for basic configuration, other available settings are described in the configuration file itself. ### Some usage examples We don't have to tell the **PConnector** witch profile to use if we set the `default_profile` parameter, but if we have more than on profile and we want to switch between them, we can use the `profile()` function like so: > **IMPORTANT**: The profile function will apply a specific profile configuration and **erase** any other setting, > so if you want to switch the profile call the `profile()` function before any other function. > #### Configuration: Some setting can be set as a profile setting, you will find those setting with **[AAPS]** annotation to distinguish them (AAPS: Also A Profile Setting). To set settings for a profile, you have to put them inside the appropriate profile array. Also, note if a setting is defined inside a profile and as global in the same time, the profile one will be used. #### Http Methods: #### Authentication: PConnector supports sending request with authentication, and to do so you need to configuration the authentication settings for the desired profile or for all the profiles. You can configure the authentication settings for the desired profile by adding the auth array in the profile config. If for some reason you don't want to include authentication while sending some request, you can tell the PConnector like so: > Remember that the profile function will apply a specific profile configuration and **erase** any other setting (in our case the `withoutAuth()` function), that why we use the `profile()` before `withoutAuth()`. #### Request ##### Localization Send **Accept-Language** header when needed: Or configure the **PConnector** to send it automatically via the configuration file. ##### Quickly change the current url Or you can use tha alias setUrl() method ##### This is the list of getters available for the request: * getRequestUrl() * getRequestMethod() * getRequestData() #### Response You can configure how do you want to save the response body: * As a string * As an object * As an array And if you want to change that for a specific response: The received response body can be retrieved using `getResponseBody()` after sending the request. This is the list of getters available for the response: * getResponseBody() * getResponseStatusCode() * getResponseHeaders() If you decode the response body as an object, you can use `getAttribute('attribute_name')` or `->attribute_name` to retrieve a specific attribute, or even you can go more deep and do `getAttribute('object.object.attribute_name', 'fallback value')`, as an example: Response status code checks: - `function responseCodeIs(int $code): bool` - `function responseCodeNot(int $code): bool` - `function responseCodeIn(array $codes): bool` - `function responseCodeNotIn(array $codes): bool` - `function responseOK(): bool` - `function responseNOK(): bool` > Example: #### Logging Example 1: Example 2: #### Debugging You can debug the **PConnector** object using the `dump()` or the `dd()` method. ### Changelog Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. ## Contributing Please see [CONTRIBUTING](CONTRIBUTING.md) for details. ### Security If you discover any security related issues, please email [email protected] instead of using the issue tracker. ## Credits - [Soufiene Slimi](https://github.com/soufiene-slimi) - [All Contributors](../../contributors) ## License The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
All versions of p-connector with dependencies
PHP Build Version
Package Version
Requires
php Version
^7.2.5|^7.3|^8.0
illuminate/support Version ^7.0|^8.0|^9.0|^10.0
guzzlehttp/guzzle Version ^7.1
illuminate/support Version ^7.0|^8.0|^9.0|^10.0
guzzlehttp/guzzle Version ^7.1
The package medianet-dev/p-connector contains the following files
Loading the files please wait ....