

Show HN: I just released Requests for PHP 1.6 - rmccue
http://journal.ryanmccue.info/269/requests-for-php-version-1-6/

======
pwenzel
I really appreciate that the documentation includes a comparison to other
libraries in this space, like Guzzle.

Is there anything special to consider when using it with the Laravel
framework?

~~~
rmccue
> Is there anything special to consider when using it with the Laravel
> framework?

Not that I'm aware of, you should be able to simply use it as a normal
library.

------
pknight
Would love to see an example of Requests and the JSON api in WordPress, i.e.
how would on go about making secure authenticated connections with a WordPress
install through the JSON api. Is that in the works?

~~~
rmccue
I see you've been following my projects. :)

[https://github.com/rmccue/WP-API-Client](https://github.com/rmccue/WP-API-
Client) is an example of using Requests with the API (and the reference client
fir the API), but it's not secure authentication, it's just a secure
connection. The way to do that is to a) enable SSL on your site, and b) point
the client to the HTTPS version of your site. That's all you need to use the
security features in Requests.

~~~
pknight
awesome, thank you!

------
michaelmcmillan
You're truly a life-saver! I ended up using Python today due to the lack of
session handling in Requests-php. Thank you so much <3

~~~
rmccue
No worries, hope it works well for you! :)

------
niteshade
Love this library, been using it a lot lately.

Expect a PR from me in the near future :D

------
LukeShu
I read the HN title as "(Requests) for (PHP 1.6)", and wondered why someone
would still be using PHP 1.6.

~~~
rmccue
Heh, thankfully I don't have to support PHP versions that old (although PHP
5.2 might as well be). It's called Requests for PHP to disambiguate it from
Kenneth Reitz's fantastic Requests library in Python, which also serves to
inspire my library.

~~~
LukeShu
Consider yourself lucky, A year and a half ago I was supporting PHP 5.1.

I _wasn 't_ confused by the title on the linked-to page, separating the
version number from the name helped.

------
julie1
PHP coded this way seems as sexy than java or c# without still the consistency
of those languages. What is the advantage of using PHP now?

The code is overbloated with complexity thus close to unmaintanable (evolution
and correction) and there are stuff that feels wrong in my guts:
[https://github.com/rmccue/Requests/blob/master/library/Reque...](https://github.com/rmccue/Requests/blob/master/library/Requests.php#L682)
the naming is WRONG: flattening a list is not what he is doing: it is
transforming a nested data structure in a level 1 associative array. Each
wrong naming is a landmine waiting to explode at your face.

This language now strikes me as an odd frankenstein that has no advantages
anymore for coding.

And this code is hiding its weakness in ridiculously complex OOP: every single
methods are _static_ for me it is the sign it should have been a namespace
exporting functions.

~~~
krapp
Not disputing or supporting your particular point about the style here, but
problems with PHP as a language and problems with PHP as coded by a particular
developer are two different things.

Weirdly, people seem to ascribe the latter to the former rather often around
here.

~~~
julie1
hum, the language as a 3rd important value that is undervaluated: culture!

The language brings a culture and the efficiency of a language is
indissociable from its average programming culture.

The rant of torvalds against C++ for coding is not about the language but the
culture of the developers. [http://article.gmane.org/gmane.comp.version-
control.git/5791...](http://article.gmane.org/gmane.comp.version-
control.git/57918)

The same rant can be made on PHP and this code is just a very vivid example of
this point.

PHP is not a fractal of bad design, a language is primarily a media to convey
ideas and concept from human to humans and actually if the culture of the
users is sub level, whatever the quality of the language is the code will be
shitty.

PHP has attained a critical mass of ignorant developers that are dragging not
only their whole language down but also of the whole eco system (managers,
sysadmins...), so PHP is not only a bad language it is also a bad culture we
should try to eradicate :)

~~~
krapp
Is someone forcing you to use PHP? If you don't like it, don't use it. If you
don't like the culture, then by all means, either try to improve it or don't
participate in it. Luckily, the universe of software is large enough that you
need never touch PHP if you don't want to. PHP is just a tool, one which many
developers find useful, and which yes supports a lot of shitty code. Go make
an app in Django or Rails or... whatever. The world is your oyster.

But the idea that it should be 'eradicated' is just plain silly. If we
eradicated every language some random purist found offensive we'd be left
coding in raw binary.

~~~
julie1
PHP, django, rails you really like bloated software that have conceptual flaws
and constant security advisories?
[http://cve.mitre.org/data/refs/refmap/source-
MLIST.html](http://cve.mitre.org/data/refs/refmap/source-MLIST.html)

And yes I am forced to use PHP or any cited bullshitware because all these
coders are intoxicating my customers with false hope, and false expectations
that after close lookups (especially the Total Cost of Ownership including
maintaining) systematically fail to deliver what was promised.

Would you listen to someone who says coding correctly takes time but
maintaining will be easy or the enthusiasts that are saying I have a framework
that "works" (but is not) and I can deliver in no time? (disregarding the
actual quality of the code they are using, or the operational complexity (thus
additional recurring costs), or ignoring the big O notations). Advocates of
BSware don't care about the details. But the devil lies in the details.

There is no shortcut for being a decent programmer; you have to have the
control over everything.

I say it loud and clear: because of their culture some language and tools turn
decent smart people into incompetent frauds that contaminate the work of every
developers. Incompetency is a cancer that contaminates the economy and costs
an awful lots of bucks.

~~~
krapp
By all means then... because we are all thoroughly tired of bloat, conceptual
flaws and security issues in our code... enlighten we simple peons as to the
language we should rather be writing our web apps in.

And you can't say C, because PHP is already a wrapper for C, and of course PHP
is terrible.

