Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Automating WordPress for Fun and Profit - WordCamp NL 2022

Automating WordPress for Fun and Profit - WordCamp NL 2022

This presentation is about how to automate WordPress using the REST and GraphQL API’s. There are quite a lot of plugins to help you automate WordPress, plugins however come at a performance cost, might fail and they need to be regularly updated.

WordPress REST and GraphQL API’s make it easy to automate all sorts of tasks, while handling errors gracefully without needing to resort to using any plugins.

In this talk we will look at how you can use the WordPress REST and GraphQL API’s to create all sorts of automations, uptime monitoring, image generation, database cleanup, backups, updates, ….

We will have a look at different no-code, low-code tools to help you setup automations, Zapier, Github Actions, Pipedream, Cronhooks, CloudFlare Workers etc.

URL: https://netherlands.wordcamp.org/2022/

---
Info about DOCman for WordPress: https://www.joomlatools.com/wordpress

Johan Janssens

September 15, 2022
Tweet

More Decks by Johan Janssens

Other Decks in Programming

Transcript

  1. http://www.joomlatools.com/developer @joomlatools
    Automating WordPress
    A story about the PHP, the web and
    WordPress automation.

    View Slide

  2. Johan Janssens

    Joomla Co-Founder / Former Lead Developer
    @johanjanssens
    johanjanssens
    johanjanssens

    View Slide

  3. DOCman for Joomla

    View Slide

  4. DOCman for WordPress

    https://demo.joomlatools.com/wordpress

    View Slide

  5. http://www.joomlatools.com/developer @joomlatools
    Automating WordPress
    Without further ado …

    View Slide

  6. http://www.joomlatools.com/developer @joomlatools
    We have plugins for that!
    But … but … Johan …

    View Slide

  7. View Slide

  8. http://www.joomlatools.com/developer @joomlatools
    A bit of history
    and context

    View Slide

  9. The HTMLolithic era
    In the beginning, let’s call it the HTMLolithic era, if you wanted to
    publish on the internet you had no choice but to learn HTML, and
    produce a static HTML page that you could link to by its Unique
    Resource Location (URL).

    View Slide

  10. 1991, the www is born ….

    View Slide

  11. 1
    The first web page went live on August 6, 1991. It was dedicated to information
    on the World Wide Web project and was made by Tim Berners-Lee. It ran on a
    NeXT computer at the European Organization for Nuclear Research, CERN.


    The first web page address was http://info.cern.ch/hypertext/WWW/
    TheProject.html.


    View Slide

  12. 1990, the
    fi
    rst web server

    View Slide

  13. 2
    http://info.cern.ch/hypertext/WWW/TheProject.html

    View Slide

  14. 3
    The Hypertext Markup Language (HTML) is a simple markup language used to create
    hypertext documents that are platform independent. HTML documents are SGML
    documents with generic semantics that are appropriate for representing information
    from a wide range of domains.


    HTML markup can represent hypertext news, mail, documentation, and hypermedia;
    menus of options; database query results; simple structured documents with in-lined
    graphics; and hypertext views of existing bodies of information.


    From: https://www.w3.org/MarkUp/html-spec/

    View Slide

  15. 4
    HTML 2.0 included everything from the original 1.0 specifications but added a few new features to
    the mix. » HTML 2.0 was the standard for website design until January 1997 and defined many
    core HTML features for the first time.


    For more history: https://www.yourhtmlsource.com/starthere/historyofhtml.html


    View Slide

  16. The Dynamolithic era
    In evolutionary terms, the next step for web publishing didn’t take too long.
    In the Dynamolithic era, instead of a single
    fl
    at
    fi
    le to build and display a
    page, pages were split up into re-useable blocks and could be coupled to a
    database.
    This made the task of publishing articles a lot easier as the developer could
    build multiple pages whilst reusing code for common areas like headers and
    footers, as well as import data that was held in a database, in order to
    display an HTML page.

    View Slide

  17. 1995, PHP/FI is announced….

    View Slide

  18. 5
    PHP development began in 1994 when Rasmus Lerdorf wrote several Common
    Gateway Interface (CGI) programs in C, which he used to maintain his personal
    homepage. He extended them to work with web forms and to communicate
    with databases, and called this implementation "Personal Home Page/
    Forms Interpreter" or PHP/FI.


    PHP/FI could be used to build simple, dynamic web applications. To
    accelerate bug reporting and improve the code, Lerdorf initially announced the
    release of PHP/FI as "Personal Home Page Tools (PHP Tools) version 1.0”.

    View Slide

  19. 6
    Early PHP was not intended to be a new programming language, and grew organically, with Lerdorf
    noting in retrospect: "I don't know how to stop it, there was never any intent to write a
    programming language [...] I have absolutely no idea how to write a programming language, I just
    kept adding the next logical step on the way."
    A development team began to form and, after months of work and beta testing, officially released
    PHP/FI 2 in November 1997.

    View Slide

  20. 7
    Zeev Suraski and Andi Gutmans rewrote the parser in 1997 and formed the base of
    PHP 3, changing the language's name to the recursive acronym PHP: Hypertext
    Preprocessor Afterwards, public testing of PHP 3 began, and the official launch
    came in June 1998.
    They then started a new rewrite of PHP's core, producing the Zend Engine in 1999
    They also founded Zend Technologies in Ramat Gan, Israel. On May 22, 2000,
    PHP 4, powered by the Zend Engine 1.0, was released.

    View Slide

  21. 8
    Selecting data from an MySQL database and rendering HTML 4 using PHP.

    View Slide

  22. The Webpubolithic era
    Once the permanency of the internet had been established, individuals
    and businesses all over the world were clamouring to get a website
    online. This led to the natural evolution of web publishing systems that
    would allow non-developers to write and publish articles to a website.
    Like their ancestors in the dynamolithic, web publishing systems could
    be connected to a database in order to provide dynamic content to an
    otherwise static HTML page.

    View Slide

  23. 2003, WordPress

    View Slide

  24. 9
    WordPress was released on May 27, 2003, by its founders, American developer Matt
    Mullenweg and English developer Mike Little, as a fork of b2/cafelog. The software is
    released under the GPLv2 (or later) license.


    “WordPress is a factory that makes webpages” is a core analogy designed to clarify
    the functions of WordPress: it stores content and enables a user to create and
    publish webpages, requiring nothing beyond a domain and a hosting service.


    WordPress has a web template system using a template processor. Its architecture
    is a front controller, routing all requests for non-static URIs to a single PHP file which
    parses the URI and identifies the target page. This allows support for more human-
    readable permalinks.


    From: https://wpshout.com/courses/learn-wordpress-development-the-basic-course/
    wordpress-is-a-factory/


    View Slide

  25. http://www.joomlatools.com/developer @joomlatools
    …so yes you can use
    plugins, but … WordPress
    isn’t the most ideal for web
    automation

    View Slide

  26. The Automatolithic era
    In the automatolithic era, which we are living in today, the number of WordPress
    websites on the internet multiplied exponentially, more than 40% of the internet
    now runs on it.
    Web technology has also evolved exponentially, websites are no longer silo’s of
    data but need to interact and integrate with other systems.
    This is creating new challenges to ensure WordPress sites can be kept maintained
    and can be connected with third party services.

    View Slide

  27. 10
    2000, Representational State Transfer

    Roy T. Fielding
    @
    fi
    elding

    View Slide

  28. 11

    View Slide

  29. JSONAPI v1.1
    https://jsonapi.org/

    View Slide

  30. 12
    A JSONAPI document

    View Slide

  31. GraphQL, query language

    View Slide

  32. 13

    View Slide

  33. 14

    View Slide

  34. 15

    View Slide

  35. http://www.joomlatools.com/developer @joomlatools
    Automation tools
    for WordPress Geeks!

    View Slide

  36. 20
    https://cronhooks.io

    View Slide

  37. 16
    https://zapier.io

    View Slide

  38. 17
    https://pipedream.com

    View Slide

  39. 18
    https://pipedream.com

    View Slide

  40. 19
    https://github.com/features/actions

    View Slide

  41. 21
    https://workers.cloud
    fl
    are.com

    View Slide

  42. 22
    https://replit.com

    View Slide

  43. http://www.joomlatools.com/developer @joomlatools
    … what about PHP?

    View Slide

  44. 3
    OpenSwoole is a CLI PHP extension that allows you to build high-performance,
    async multi-tasking webservices and applications using an easy to use Coroutine API.


    Compared with other async programming frameworks or software such as Node.js, Go,
    Python, ... OpenSwoole is a complete async solution that has built-in support for async
    programming via coroutines.


    It offers a range of multi-threaded I/O modules (HTTP Server, WebSockets,
    TaskWorkers, Process Pools) out of the box and support for popular PHP clients like
    PDO for MySQL, and CURL.


    You can find more info at https://openswoole.com

    View Slide

  45. Swoole Performance vs PHP frameworks
    40x faster then Laravel/Symfony

    View Slide

  46. Swoole Performance vs Nodejs and Go
    4x faster then Node.js

    View Slide

  47. More Info
    http://twitter.com/joomlatools
    http://github.com/joomlatools
    http://facebook.com/joomlatools
    http://www.joomlatools.com

    View Slide