Gmail Service in Symfony2 - php

I need to use the Gmail service in my project in Symfony2. I installed the Google Suite via composer but I noticed that it is really too much for what I do. I need only the services and Gmail API. Is there a way to just download the Service Gmail and not all of Google ever via composer?
Thanks for the possible response.

I need to use the Gmail service in my project in Symfony2.
I'd suggest using an existing package:
fourlabs/gmail-doctrine-bundle or
adevait/gmail-wrapper
Both packages use google/apiclient interally to access the Google API.
I installed the Google Suite via composer but I noticed that it is really too much for what I do.
What is Google Suite? Which package are you referring to?
I need only the services and Gmail API. Is there a way to just download the Service Gmail and not all of Google ever via composer?
Composer fetches development dependencies. That doesn't mean that you have to ship all of the fetched stuff. You can reduce the size of your project by deleting unnecessary parts (before you package for deployment).

Related

Azure B2C integration with PHP

Hope you can help with, we are building a new customer portal and would like to use Azure B2C for various reasons including the need to interface with MS Dynamics CE. However, our tech stack is PHP, Slim to be precise.
Does anyone have experience of delivering a fully functioning production app with this configuration?
Would love to hear from you and have your assistance.
Please get in touch.
Thanks, Duong.
To deploy the PHP Web Application using Azure AD B2C,follow the below steps :
Install PHP, Laravel (it's web framework).
Create a Web App in Azure Portal B2C blade by noting the ClientID and Client Secret from the Application.
Clone and customize the source code from github: git clone https://github.com/Azure-Samples/active-directory-b2c-php-webapp-openidconnect.git
Download the latest version of the php security library in your repo.
To deploy into Azure, you need to set-up the Deployment settings by selecting Local Git Repository and setting up the username and password for deployment.
git init and git remote add azure [deployment url] commands are used to set up deployment to azure.
git push azure master to deploy online.
Instead of depending on their own code, developers can rely on B2C for consumer sign up and sign in.
Using OpenID Connect, we can validate the authentication token of the users connected with the Azure B2C of the PHP Web Application.
Please refer this GitHub article for code and more information.
I've implemented B2C integration on Azure with a Slim 4 application, what is it you need to know?
In short:
Set up B2C in Azure
Set up Client ID en Secret in external provider and store in Azure Key Vault
Create a middleware service that looks for the client token in requests for the routes you want to protect
I haven't written a blog about it yet, but expect one in March at www.azurephp.dev with a working example using Slim 4. In the mean time, I hope this short answer works for you. If not, ping me.

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

Openshift -- install depedencies via composer?

I've created a project using openshift and php (i use fillezila for server transfers etc.. not git)
As part of my project i want to upload files to my google drive,
google API state that i should install the Google Client Library with composer.
I couldn't find a simple beginners guide on how to use the composer in openshift and what should i do with it. I am a complete beginner in php and composer use.
Bottom line i want a simple way to upload file to google drive without authentication every time. (for example PHPMailer let you send mail without authentication every time my PHPMailer script sends email to gmail, my password and user name are part of the script).
If I must use google drive API.
Please explain how to use composer on openshift for google drive to install the library using composer and upload a file to the drive.

Can not find ses.php while using php-aws-ses sdk for Amazon SES

I am trying to use this simple library for using amazon email service.
the library is here The example shown requires ses.php but I can not find where the ses.php is. I have also tried on the author's website which is here. But still got no idea where this comes from. Is it some standard file to be downloaded from amazon AWS sdk ?
Any help would be apprecaited.
The developer daniel-zahariev has now resolved the issue in the repo after I sent him my inquiry. instead of using ses.php need to include following files
require_once('SimpleEmailService.php');
require_once('SimpleEmailServiceMessage.php');
require_once('SimpleEmailServiceRequest.php');

How do we setup oAuth server?

I want oAuth verification process for a mobile application.For that i need to setup an oAuth server which listens to the requests and grant the access tokens.How do i set this up?I didnt found any relevant help on net.Please let me know.Also it will be good if it could be done using CakePHP
Regards
Himanshu Sharma
You would need an OAuth library for PHP that implements an OAuth service provider.
There are PECL and PEAR OAuth libraries, but my personal testimony is oauth-php as its simpler. I implemented both a server and client with it.
I cant comment on writing a service provider in Cake.
Updates based on OP's comments
Copy that directory to your PHP application to "install" it. You would need only CURL support from your host. There are no other prerequisites from the part of your host.
I did these steps to write an OAuth provider with oauth-php, do try these, google it and ask new questions when you get stuck.
read illustrated guides on how OAuth works
Studied relevant chapters from http://oauth.net/core/1.0a/ (try this order: 3,4, appendix,6 and 7 to start with)
read the example files included with the library, and see the how-tos in site's pages
hack those files and build it up your application

Categories