Where are the full refs for getstream.io REST api? - php

I've been implementing PHP getstream.io support for our app, found that the official PHP library is lacking compared to Python one.
Checking official api refs on getstream.io site - seems they are not full by any means as well.
For example - we have 'stats/follow/' endpoint, allowing to get following/followers counts easily, quite a common thing to use for user profiles. I found it by reading python lib. But it is not documented at all on the official site, there are no mentions it even exists.
Am I looking for the full api refs in the wrong place (on getstream.io official site)?
Maybe there are a lot of other useful endpoints I am not aware of, as they are not present in the official refs?

stats/follow is a recent addition (beta right now) which isn't added to PHP SDK at the moment. PRs are always welcome (good to imitate Python SDK). Anyway, it will be added though, just a matter of time.
REST docs will be auto generated in near future.

Related

PayPal: Verify webhook notifications in PHP

PayPal's documentation is pretty bad, but they do have a PHP notification verification sample here which mentions:
PHP Currently does not support certificate chain validation, that is necessary to validate webhook directly, from received data. To resolve that, we need to use alternative, which makes a call to PayPal's verify-webhook-signature API.
It also includes some files that aren't within the Checkout SDK. I found this question from a year ago in which someone created what seems like a decent explanation of all of the various missing packages and files that aren't included in the base SDK.
One of the key parts of their answer was to install a separate PayPal SDK, which they don't mention anywhere in the documentation, via composer (without mentioning its package name). Luckily composer has decent recommendations to my incorrect attempts at finding it so I got it eventually with: composer require paypal/rest-api-sdk-php. Looking through the files it downloaded, it's clear that this is the package that the Paypal documentation I listed above is including. However, upon requiring it I got the message
Package paypal/rest-api-sdk-php is abandoned, you should avoid using it. No replacement was suggested.
This seems pretty cut and dry, that it's not future safe and I shouldn't use it, but what am I supposed to do instead? Is there some new SDK somewhere I should be looking at or have they just given up on PHP and I have to just start making direct hand crafted API calls?
There is no supported SDK for webhooks -- not for PHP, nor for any other environment. Use a direct HTTPS integration.

Generating API documents in Git Workflow

Not sure if this should be here or on Programmers.
Generating API documents
I would like some advice on how I should generate API documentation for an internal project. I am relatively new to Git and we are trying to implement some sound build/deploying practices.
One of the things we discussed was making sure our code base is well documented and generating documentation using something like PhpDocumentor2 or one of the many similar tools.
We have started to implement a workflow similar to the one detailed here.
Should I automate when the docs are built?
For example a pre or post commit hook in git when tagging a release. Or should when I merge develop to a release branch just manually create the docs and commit to the repository?
Is it standard practice to have docs generated for each release?
I might have misunderstood the process, should a new doc release correlate with a git release/tag?
Where do you store the generated docs?
In the same repository? a different repository? Hosted somewhere like Read The Docs or just internally?
The current project we are working on is only small, but we would like to roll out the process to other larger projects in the future if successful.
Context
The project is a Magento extension which we would like to provide API docs, unit testing, and PSR conforming code. I am lacking information on how the whole workflow integrates. PHPunit and PHPDocumentor2 are installed locally via Composer.
I have heard and looked at Travis Ci, but I'm not sure if Docs fall in to that category.
This question may seem petty and/or trivial, however, I've not much experience in integration and git workflow and I couldn't find much information around.
Generated documented generally are:
always in sync with the code source (so the question of "should a new doc release correlate with a git release/tag" becomes moot)
not stored in a version control referential (like a git repo), but rather (re-)generated at will (in any location you like).
If you look at a project with a large code source, and an extensive code documentation, you can take as an example the language Go and his repository (a mercurial repo, but you have mirror on GitHub as well)
static documentations like the specs, articles, release notes, ... are kepts within the repo, as they are not generated, but updated manually, and are tightly linked to the sources.
Code documentation is kept separately in a static web site.
Documentation for all go project is kept in a static website GoDoc, which will fetch the sources of Go projects, and generate the documentation from them.

Google Moments in google's own php library, are not working

I have struggled with google's php library, the latest version of which is available on their own website. While the simple google plus example they provide works fine (it's a basic login with GET features), there is no way to add a moment activity via app in php - at least not for me.
Their own example isn't working (the example can be retrievd in the library: examples/moments/simple.php)
Someone provides an answer here but the button demo they provide isn't working either if I press (authorization is fine, posting produces no action.
Does anyone have a suggestion on how to change their own php file so to make it work? I tired removing all the code and resetting it to the basic action: at least I am not getting oauth or php errors, but the file produces no action.
I understand that posting moments in php is not currently supported, but I have a web app and android implementation wouldn't work for me I think.
At the moment you need to get the library from the trunk, you can find instructions here.
This gist documents how to request permission and write activities.
The old moments api has been deprecated and those samples are for the old API, I'll remove them from the codebase as soon as possible. Thanks for raising this question!

OAuth 2.0 Server for PHP

I have been struggling to find an active open-source PHP project that supports OAuth 2.0 as a server. There are tons of client examples that connect to Facebook, Twitter, etc. but as more and more people want to expose their own services through an API I'm a bit surprised the open source community hasn't addressed this need already. It's not that there is nothing but what's there is mostly out-of-date, little-to-no documentation, and very little to no activity in terms of current development and conversation.
Am I missing a good open-source option out there? Does anyone know of any commercial options? I really need to get something in place soonish and I personally don't have the bandwidth or security credentials to tackle this problem myself.
After much searching around I believe I have found the best solution for PHP'ers out there. Opinions are a dime a dozen but here's my favourite:
http://bshaffer.github.io/oauth2-server-php-docs/
Very active, high quality conversation and a solid product along with good (and improving) documentation.
Here is the list of available server and client libraries:
http://oauth.net/2/
which leads to a github project which is maintained.
oauth2 server by php league is much more followed and downloaded project on github. My personal experience has been awesome and the best part is it's documentation. Excellent implementation of oauth2.
According to http://www.zimuel.it/oauth2-apigility/ & http://apigility.org/documentation/auth/authentication-oauth2
You now can implement OAuth 2.0 Server using the open source project Apigility, with Brent Shaffer's implementation underneath...
in the end...
The OAuth2 implementation in Apigility uses the oauth2-server-php
library by Brent Shaffer. Apigility uses a PDO database to store all
the information related to the OAuth2 protocol. You can create your
database using the schema reported in the file
/vendor/zfcampus/zf-oauth2/data/db_oauth2.sql under your Apigility
installation folder (zf-apigility-skeleton).

What issues does CakePHP cause when using the JanRain openid library?

I'm implementing an OpenID consumer, and utilizing the JanRain classes (2.2.2) is failing out of the box. Specifically, I'm seeing the following symptoms:
The consumer isn't able to correctly identify the openid_mode parameter
The consumer has trouble finding the return_to variable
I'm fairly certain CakePHP is causing the issue, as the sample code in the JanRain consumer example works fine, but it fails as soon as it's placed within a CakePHP controller.
I have noticed that CakePHP's dispatcher sets a $_GET[url] parameter that confuses the JanRain validation, but I've been able to get around that one (by unsetting $_GET['url']). I'm hoping someone out there may have a short list of tips/techniques to get CakePHP to play friendlier with the JanRain code.
I'm sorry I don't quite understand your problem, but since I am successfully using the JanRain plugin for quite a while now, here is at least one tip I remember from when I set it up : Try lowering your CakePHP security setting from "high" to "medium" or even "low", at least for testing purposes.
If it doesn't help, and you think you know what part of your code is causing the issue, let me now, I'll provide you with my sources.
Try the OpenID component for CakePHP linked here which is regularly updated and works
Ensure you have lib CURL and openssl extensions enabled

Categories