Integraring Xero Accounting API with PHP (Laravel) - php

I'm simply trying to implement an event that creates an invoice on Xero everytime a payment is processed on Laravel backend. Its been 3 days now trying to install their SDK, many non official packages and I still don't understand how to do that. Their documentation is so bad, I don't understand everything with Xero either.
Question: What should I be looking for to achieve what I want? All guides and docs explain how to connect some sort of third party users with my Xero account, using oAuth2, a callback, getting tenants and such, I have found nothing about just using their API to create a new invoice to my own Xero account.
Everything I said might be plain gibberish, if so, please correct me.
Best Regards

Xero now has an official PHP SDK available on GitHub.
https://github.com/XeroAPI/xero-php-oauth2
A developer in our community created a wrapper for Laravel
https://github.com/XeroAPI/xero-php-oauth2#laravel
This starter project shows how to handle the OAuth2 flow
https://github.com/XeroAPI/xero-php-oauth2-starter
and a video showing how to use the starter project
https://www.youtube.com/watch?v=vc1d7vdWeOE
We have SDK reference docs with runnable code examples as well
https://xeroapi.github.io/xero-php-oauth2/docs/v2/accounting/index.html
I hope the above resources help

Related

MyPOS Payment Gateway integration with PHP Laravel via API (Not SDK)

I am trying to implement myPOS (https://www.mypos.eu/) with PHP with API and flutter.
Basically I want to strike API call by the Laravel from flutter app to MYPOS gateway.
I have gone through the official documents with this link. The OAuth API as per this link implemented with PHP but not able to get the results.
I have created the developer account, added the client_id, client_secrets at the required place, followed all the given steps in official document, but still not able to get the required and expected results.
It seems, at some point, the official document is missing some steps with example for the implementation.
It would be great if one can provide an example.

How to use Firebase Auth Admin SDK via Rest Api?

We have been developing a multi platform project which will eventually have an Android app, an iOS app and a web application. We are impressed with the features offered by Google Firebase therefore trying to leverage the opportunities.
Since our product is a multitenant software-as-a-service application we have custom authentication requirements. Therefore we followed the custom authentication implementation path of Firebase and it is functional now.
Our mobile clients send login requests to our API server,
Our API server issues customTokens and reponds them back to the clients,
Clients call signInWithCustomToken(customToken) method to sign in to Firebase.
So far so good.
What the issue is, our backend is in PHP and Firebase doesn't have an official Admin SDK for PHP. Yes, there is a package called kreait/firebase-php on Composer however it is far away from covering all of the Auth Admin SDK features. For example, there is a documented disable-user feature which is available on Firebase Admin SDK, however that operation is not implemented on the kreait/firebase-php package.
On the other hand Firebase has a Auth Rest API which just works with the API KEY. However, (I suppose ) it is designed to work on the client side therefore it just has operations for the authenticated user.
Our API server is already hosted on Google Compute Cloud and has the maximum set of access permissions on the Google Cloud services.
We have the Firebase service account file to work with the Firebase Auth services.
What we need is to consume all available Firebase Admin SDK features (possibly via Rest). For example, we would like to call revokeRefreshToken(uid) when a user changes his/her password on one of his/her devices.
Since at this specific issue there isn't any documentation, what would you advise us to do?
Update (25 January 2018)
The above mentioned missing endpoints on the Firebase unofficial PHP Admin SDK are now implemented by the maintainer after a productive discussion on a Github issue. However, I would like keep this question open since the nature of the question is asking for ideas for further collaboration and discussion.
Maintainer of said unofficial PHP SDK here :). You already have updated your original post to include that the SDK now supports the features that were missing.
I am posting this as a dedicated answer to be visible to people arriving here and searching for answers as well.
Although the Admin SDK for PHP is still not feature complete, we are getting there. I added feature matrix to the README of the Github project so that you can quickly see what is available and what isn't.
Going forward, I will implement new features by either implementing things similarly to the official Admin SDKs (especially https://github.com/firebase/firebase-admin-node) and by using the existing libraries provided by the Google Cloud Platform Library.
At some point in the future, Google will certainly provide all the necessary building blocks to use Firebase efficiently with PHP, but until then, I am happy about every happy PHP developer using my library :).
FYI: I just released a new version (4.1.0) which includes support for Firebase Cloud Storage and did in fact use the google/cloud-storage for that.
I think you can use the Identity Toolkit libraries provided by Google. Here's the one for PHP: https://github.com/google/identity-toolkit-php-client

Youtube Analytics PHP cron

I want to start developing a tool that runs daily via cron for getting daily analytical data from one channel, or video, etc.. through the "Youtube Analytics API". And not what is the best way to approach it.
I have read the documentation of Google and and I have several questions:
I created the project in the console (https://code.google.com/apis/console/) but I doubt what kind of application I have to choose when I create a Client ID (Web Application, Service Account or Installed aplplication).
What PHP library use?
It's a very new API and not much information.
In the Google GData site there is a warning about that "Most newer Google APIs Google Data APIs are not Google Data APIs." and in the google-api-php-client, no examples of this API.
What is the best method for authentication in a cron?
As you can see I am very confuse, can someone help me, please?
Thank you.
1) It will be an installed application unless you will run it in a web server.
2) Use the official library, add the ytanalytics php library. Samples: https://github.com/youtube/yt-samples-php
3) You can do so by getting a refresh token from OAuth2 Playground and setting it in your youtube object.
Here it explains a little more.
And a step by step video.

Why the Facebook PHP SDK is out of date? What is the alternative?

I'm so frustrated right now. I spent so much time trying to debug my application to find out that the official PHP SDK from Facebook is out of date and doesn't look like it's maintained anymore: https://github.com/facebook/facebook-php-sdk
After lodging a bug to Facebook because of an error returned by the API, one of the employee at Facebook respond the following:
THe old REST API does not support use of Page Access Tokens, you need to use the Graph API for such API calls - if you're using an SDK, please ensure it's routing your FQL queries to https://graph.facebook.com/fql?q=X and not https://api.facebook.com/method/fql.query
However in the PHP SDK that Facebook provide it's using the following request:
URL: https://api-read.facebook.com/restserver.php
GET: method=fql.query&return_ssl_resources=1&query=SELECT+comment_info.comment_count%2C+created_time%2C+like_info.like_count%2C+permalink%2C+post_id%2C%0A+share_info.share_count%2C+type%2C+attachment.media%0A+FROM+stream%0A+WHERE+actor_id%3Dxxxxxx%0A+AND+source_id%3Dxxxxxx%0A+ORDER+BY+created_time+DESC%0A+LIMIT+100&callback=&api_key=xxxxxxxxx&format=json-strings&access_token=xxxxx
Anyone bumped into this issue? What SDK are you using instead?
The PHP SDK on Github is still maintained and the official source (see https://developers.facebook.com/docs/reference/php/)
Still, old API (like the REST api) are still supported for backward compatibility concerns. But for new stuff, you need to use the Graph API. If you read the documentation, it is very clear that the Graph API is the way to go (there's no mentions of REST api in the documentation). https://developers.facebook.com/docs/reference/php/facebook-api/
So, I think the issue here is you started of reading some old blog posts without reading the official APIs docs. Honestly, around Facebook stuff, only believe what you can find in the official documentation and on StackOverflow with a good vote rating. Too many bad developers have been trying to bring SEO to their websites writing shitty article on developing Facebook apps.

Basecamp OAuth2 with PHP

I am trying to create an app for Basecamp. I managed to connect and pull data using curl (Basecamp API using cURL and PHP). However this requires the users login data.
I would like to use OAuth2 with Basecamp as in https://github.com/37signals/api/blob/master/sections/authentication.md. Unfortunately there is 0 documentation on this and I couldnt find any sample code. I saw there are several OAuth2 libraries http://oauth.net/code/, but I have no idea what to do with them.
Can somebody please show me some php sample code of how I would authenticate a user using OAuth2 in php and than make a request to the Basecamp API?
Thank you very much in advance.
I recently had to implement OAuth 2.0 for our company. I was also browsing the web to try and find information on the topic. I came across these two websites, which helped alot.
OAuth 2.0 Implementation Example
Online Screencast
Hope this helps.

Categories