-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#5 Allow setting a proxy #27
Conversation
@qurben Have you tested it somehow? :) |
@dnl-blkv I tested it with a socks proxy through ssh to a remote server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments :)
README.md
Outdated
##### Proxy | ||
|
||
You can use a proxy with the bunq PHP SDK. This option must be a string. This proxy will be used for all requests done with | ||
the SDK. You will be prompted to provide a proxy URL when using the interactive installation script. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be smth like This proxy will be used for all the requests done with the context for which it was specified
?
README.md
Outdated
@@ -80,6 +80,20 @@ $apiContext = ApiContext::restore($fileName); | |||
**Tip:** both saving and restoring the context can be done without any arguments. In this case the context will be saved | |||
to/restored from the `bunq.conf` file in the same folder with your script. | |||
|
|||
##### Proxy | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this newline? :P
README.md
Outdated
the SDK. You will be prompted to provide a proxy URL when using the interactive installation script. | ||
|
||
```php | ||
$proxyUrl = 'socks5://localhost:1080'; // The proxy for all requests, leave empty to disable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave empty? So, empty string disables it?
src/Context/ApiContext.php
Outdated
@@ -331,6 +346,14 @@ public function getEnvironmentType() | |||
} | |||
|
|||
/** | |||
* @return string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|null
src/Context/ApiContext.php
Outdated
@@ -331,6 +346,14 @@ public function getEnvironmentType() | |||
} | |||
|
|||
/** | |||
* @return string | |||
*/ | |||
public function getProxyUrlOrNull() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We typically do not do OrNull in the getters in the SDK code. The reason is that the option of nullability is already stated in the doc header, and adding it into method name is not a normal practice among the PHP community.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Save the proxy in the ApiContext. Allow an api context to not contain a proxy.
Fixes #5