-
Notifications
You must be signed in to change notification settings - Fork 270
DOC-4520 added PHP client page #845
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
Conversation
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.
Needs a few tweaks.
Co-authored-by: David Dougherty <[email protected]>
Co-authored-by: David Dougherty <[email protected]>
Co-authored-by: David Dougherty <[email protected]>
|
@dwdougherty Feedback applied. Thanks for spotting those problems. |
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.
LGTM.
| use Predis\Client as PredisClient; | ||
|
|
||
| $r = new PredisClient([ | ||
| 'scheme' => 'tcp', |
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.
All of this are default values, can be omitted for simplicity
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.
@vladvildanov I've removed them. There's another example in the page that illustrates them, so as you say, best to use the simplest example to start off.
| Store and retrieve a simple string to test the connection: | ||
|
|
||
| ```php | ||
| echo $r->set('foo', 'bar'), PHP_EOL; |
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.
PHP_EOL constant is equal to "\r\n", should be concatenated with other string echo $r->set('foo', 'bar') . PHP_EOL;
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.
@vladvildanov The doc page for echo says you can use either the comma (ie, two parameters) or the dot (ie, concatenation) for this. Is there any reason to prefer concatenation here (efficiency, standard practice, etc)?
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.
Hmm thanks for pointing out. In this case it should be fine. This was based on my personal experience, I never meet the comma approach.
|
|
||
| echo var_export($r->hgetall('user-session:123')), PHP_EOL; | ||
| /* | ||
| array ( |
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.
array() call is an old way to create an array, used before 5.4 version. The best practice now is a new notation, just like in the other versions [ 'name' => 'John', 'surname' => 'Smith', 'company' => 'Redis', 'age' => '29',];
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.
@vladvildanov This comment shows the output from the echo command. The var_export function does actually format the array string like this (I've just tried it). In most of the other examples, we have ">>>" at the start of output sample comments to make it clearer that were showing the results of the previous command. I'd forgotten to add them here but I've put them in now.
DOC-4520
New client page for PHP. Note that we probably can't add examples for testing and we won't be supporting the full range of tabbed samples for PHP just yet.