Live data from Hacker News

WordPress Plugin Development: Talking to APIs

curry-software.com

11–20 of 21 posts

Re: WordPress Plugin Development: Talking to APIs

#11
post #9

Earlier quoted context omitted.

>With the current plethora of widely-supported Web development frameworks, I really don't see any reason to use PHP or Wordpress for new projects. Agreed. The thought of using raw cURL in PHP to write an API service layer makes me shudder.

The people who use the websites, really like wordpress. Nothing else is simpler and also does the job 99% of the time.

It definitely gets the job done. But as soon as the job's done and you want anything else, it becomes a complete nightmare.

Re: WordPress Plugin Development: Talking to APIs

#12

This is a really useful and informative writeup. However, to me it just highlights a lot of things that Wordpress/PHP is bad at. For one, no mention of testing here (or really hardly anywhere in PHP-land), although keeping the API logic in a separate class is a good idea. Also, the flexibility/ease of use tradeoff going from wp_remote_get and friends is terrible. It's so frustrating that PHP doesn't have a better gen…

What are the alternatives to Wordpress? Every time a small business comes to me and wants a website, my answer is Wordpress + a theme + one or two plugins. I'm not aware of anything else with as many themes or plugins available, or as easy to get going.

I'm a C++ dev, not a professional web developer, but I help out friends and family. With Wordpress I usually bill around 4 hours to do a website for someone if they have the content written.

Re: WordPress Plugin Development: Talking to APIs

#13

This is a really useful and informative writeup. However, to me it just highlights a lot of things that Wordpress/PHP is bad at. For one, no mention of testing here (or really hardly anywhere in PHP-land), although keeping the API logic in a separate class is a good idea. Also, the flexibility/ease of use tradeoff going from wp_remote_get and friends is terrible. It's so frustrating that PHP doesn't have a better gen…

> For one, no mention of testing here (or really hardly anywhere in PHP-land), [...]

In a different life I had to maintain a website based on the Drupal CMS and also one based on the then-popular Laravel PHP framework, and in both environments testing was common and well-supported. As much as I dislike PHP, such a blanket statement does not hold up.

Re: WordPress Plugin Development: Talking to APIs

#14
post #13

This is a really useful and informative writeup. However, to me it just highlights a lot of things that Wordpress/PHP is bad at. For one, no mention of testing here (or really hardly anywhere in PHP-land), although keeping the API logic in a separate class is a good idea. Also, the flexibility/ease of use tradeoff going from wp_remote_get and friends is terrible. It's so frustrating that PHP doesn't have a better gen…

> For one, no mention of testing here (or really hardly anywhere in PHP-land), [...] In a different life I had to maintain a website based on the Drupal CMS and also one based on the then-popular Laravel PHP framework, and in both environments testing was common and well-supported. As much as I dislike PHP, such a blanket statement does not hold up.

Yeah, I think you'll see PHPUnit in Symfony projects pretty typically as well. Also Guzzle.

Re: WordPress Plugin Development: Talking to APIs

#15

This is a really useful and informative writeup. However, to me it just highlights a lot of things that Wordpress/PHP is bad at. For one, no mention of testing here (or really hardly anywhere in PHP-land), although keeping the API logic in a separate class is a good idea. Also, the flexibility/ease of use tradeoff going from wp_remote_get and friends is terrible. It's so frustrating that PHP doesn't have a better gen…

It seems to me like you're describing deficiencies in WordPress more than PHP itself.

Re: WordPress Plugin Development: Talking to APIs

#17

This is a really useful and informative writeup. However, to me it just highlights a lot of things that Wordpress/PHP is bad at. For one, no mention of testing here (or really hardly anywhere in PHP-land), although keeping the API logic in a separate class is a good idea. Also, the flexibility/ease of use tradeoff going from wp_remote_get and friends is terrible. It's so frustrating that PHP doesn't have a better gen…

The combination of syntax highlighting support literally everywhere and a borderline typeless system and command completion. Those are developer positives. Here is the deal php is crazy easy to set up(& make basic themes) and lots of clients will pay for php for similar reasons. Php shared hosting is cheap and franlky unless someone creates something similar it will continue to power the estimated 80+% of the web that it does today. WP is also a killer reason. Any sane client wants a site that isn't stuck on node.js/plugin version 2.X only.

Re: WordPress Plugin Development: Talking to APIs

#18

This is a really useful and informative writeup. However, to me it just highlights a lot of things that Wordpress/PHP is bad at. For one, no mention of testing here (or really hardly anywhere in PHP-land), although keeping the API logic in a separate class is a good idea. Also, the flexibility/ease of use tradeoff going from wp_remote_get and friends is terrible. It's so frustrating that PHP doesn't have a better gen…

Having used just about every major framework under the sun and done some WordPress work professionally, repeatedly I find that the best tools for this all wrap curl. This pattern is not as atypical as someone else suggested here. We did this repeatedly in our WordPress development.

curl has the best (in general) performance and is the most robust, reliable, battle-tested connection library there is, full stop. And it's not just limited to HTTP.

Do I really want to take a gamble with my software stack against the millions of man hours that curl has been put through? I never understood the attitude people have against curl. Problems found are fixed quickly and way quicker than in anything else.

The only place where I have found this to not be true is in the Python community, for reasons I haven't quite understood yet.

curl handles high volume, is portable, is thread safe, has features no other competitor is approaching, supports IPv6, has a stable & mature API, is well documented. What more could you want from dependable software?

Re: WordPress Plugin Development: Talking to APIs

#19
post #13

This is a really useful and informative writeup. However, to me it just highlights a lot of things that Wordpress/PHP is bad at. For one, no mention of testing here (or really hardly anywhere in PHP-land), although keeping the API logic in a separate class is a good idea. Also, the flexibility/ease of use tradeoff going from wp_remote_get and friends is terrible. It's so frustrating that PHP doesn't have a better gen…

> For one, no mention of testing here (or really hardly anywhere in PHP-land), [...] In a different life I had to maintain a website based on the Drupal CMS and also one based on the then-popular Laravel PHP framework, and in both environments testing was common and well-supported. As much as I dislike PHP, such a blanket statement does not hold up.

Behat is easily one of my favorite test frameworks and PHP, at least since 5.6, is somewhat of a sensible language now.

If you have to build the kind of site that needs to do the things that WordPress does, it's a great choice.

PHP, unfortunately, is never going to get away from the reputation that it earned and some of the choices it's stuck with, but it's a perfectly adequate language to develop web software with and the tooling these days is pretty good.

It's not my choice to use, but I'm happy to use it in a modern context.

Re: WordPress Plugin Development: Talking to APIs

#20
post #12

This is a really useful and informative writeup. However, to me it just highlights a lot of things that Wordpress/PHP is bad at. For one, no mention of testing here (or really hardly anywhere in PHP-land), although keeping the API logic in a separate class is a good idea. Also, the flexibility/ease of use tradeoff going from wp_remote_get and friends is terrible. It's so frustrating that PHP doesn't have a better gen…

What are the alternatives to Wordpress? Every time a small business comes to me and wants a website, my answer is Wordpress + a theme + one or two plugins. I'm not aware of anything else with as many themes or plugins available, or as easy to get going. I'm a C++ dev, not a professional web developer, but I help out friends and family. With Wordpress I usually bill around 4 hours to do a website for someone if they h…

I was a professional web developer and occasionally moonlight as one. If you have non-savvy people entering content, WordPress is, in most cases, the only sensible choice.

I can turn a better site around that suits most peoples' needs in Jekyll these days in less time. I took the best of both worlds here and developed a workflow of: 1) private WordPress for content editing categorized content in Kramdown using only the ACF Pro and s3 uploader plugins 2) a process that builds and deploys a jekyll site to an HAproxy load-balanced NGINX cluster whenever anyone clicks Publish.

It pulls the content directly from the wordpress database at build time and the site uses webpack and whatever javascript niceties you'd expect from a site developed in 2018.

Post reply on HN