Cees-Jan

Announcing: PHP API Clients

For a while now I'm been working on a new huge project. Been tweeting about it for a while as welland since it is my birthday I like to give the PHP community a "little" present. It is time to officially announce: PHP API Clients.

PHP API Clients

Goals

  • Community run, currently I'm working on getting everything started but I hope the project to be come a place for async first API clients beyond the ones I can personally use
  • PHP ^7.0 packages
  • Designed async first from the ground up using ReactPHP
  • Generated resources for ease of development
  • Resources/Clients for sync and async
    • Sync resources/clients wrap Async resources/clients
    • Async resources/clients return promises when returning objects, or observables when returning arrays

Async first

One of the reason I started working on these clients is that there are none to barely any asynchronous API clients in PHP. And for the rebuild of my site I want to integrate with Github, TravisCI, Twitter both for easier mass project management and shiny gimmicks. (Like the username emoji changer example for the Twitter client which puts a random emoji in the given username. It is active right now on my twitter, every time I tweet a random emoji is place between Cees-Jan and Kiewiet.) In order for everything to be able to be full asynchronous and synchronous the clients have to be async first. That means as much that all synchronous clients don't do actual work, but instead use the asynchronous client in the respective package to do the heavy lifting. This has a few advantages as there is a lot less duplicated code by using clue/block-react, by Christian Lück, to turn an async promise into a sync result that can be return as usual. (In case you want to use the async client in a more sync way, take a look at Recoil.)

Toolkit

In the coming days I'll go over the internal tool kit used in the project. Explaining each package no matter how simple. The first post will be tomorrow about the command bus.

  • Command bus

Conclusion

None of the clients is done yet, the Travis client is pretty close though. But the others aren't. There is a lot of work to be done, and I'll go over the clients and how it has influenced the development of the packages january 2017. Times are going to be excited and a lot of cool stuff is coming our way pretty soon.


Categories: PHP - API - ReactPHPTags: PHP - API - ReactPHP