Fab1en / rocket-chat-rest-client

Rocket Chat REST API client in PHP
49 stars 38 forks source link

How to add Client in Wordpress? #13

Open schudav opened 6 years ago

schudav commented 6 years ago

On the main description it says "Use this client if you need to connect to Rocket Chat with a software written in PHP, such as WordPress or Drupal."

I don't really understand how one would use this with Wordpress. I know we can add custom actions to the Wordpress functions.php file, but how would you go about installing this package to Wordpress when it uses composer?

pandymic commented 5 years ago

Composer is just a package manager that helps developers to better manage deployment of third-party libraries in their projects. Similar to npm/yarn for Node.js, or gems for Ruby or pip for Python. The platform or framework for which you're building has no bearing on whether you can use Composer or not, it's simply a development tool.

The public-facing REST APIoffered by Rocket.Chat is a very powerful tool. This project simplifies authentication and calls made to that API by wrapping them around a series of standardized methods.

You mentioned actions/hooks in your comment. One very simple use case for this library as part of a WordPress plug-in or theme is as follows:

You hook into the user_register action that is fired after a WordPress user is registered. At that time you send a request to the Rocket.Chat API that creates a user with the same username and e-mail address. Similarly on delete_user you may send a request to the API that purges the user from your Rocket.Chat database.