Is there a existing module or file to manage autoloading of sdk classes when using PHP GAE ?
This would avoid to require a file when using a class of the google sdk.
Thank you for any clue.
No nothing yet - we're investigating if this is something we want to do provide out of the box.
Related
I was implementing "Register With Social Login Buttons". I downloaded the Google Client API library via Composer. I tested that outside the yii2 framework environment and everything is working absolutely fine and I have also received the user information.
When I put all the required libraries and my view file inside Yii2 framework's folder and tried to access that view file, It is showing me an error which is included below :
Below is my folder structure in simple PHP
Here is my folder structure in Yii2 framework
Can someone help me to solve this problem?
As error says: no class found. Means autoloader is not working.
Your require autoload is wrong. Your Yii structure is different and vendor folder is 2 levels back.
Try use this path:
require '../../vendor/autoload.php';
As the title suggests, i've currently got a working Yii2 portal, which we're upgrading to enable use of SSO with SAML.
For handling the authentication we're using SimpleSAML, which is sat outside of the web root as the SimpleSAML documentation instructs.
The problem being, both Yii2 and SimpleSAML have their own instance of composer, along with its own autoloader. So i'm having problems finding a way to successfully require the SimpleSAML composer autoloader from within Yii2, which is already requiring it's own composer autoloader.
Can anyone offer any guidance on this?
I managed to solve it, rather than a problem with the require, it was a problem with calling the function the correct way in Yii2, so using the example on the SimpleSAML website, within Yii2 add a slash to whichever function you need to use, as so:
$as = new \SimpleSAML_Auth_Simple('default-sp');
You will need to fix the conflict issue patching the autoloaders.
I recommend you to read:
http://alanstorm.com/laravel_composer_autoloading
https://github.com/composer/composer/issues/3003
http://www.yiiframework.com/doc/guide/1.1/en/extension.integration
Or take a look on this easy php saml toolkit: https://github.com/onelogin/php-saml
Originally, I was searching how to use php to retrieve book information from amazon. and I found this question:
How can I use Amazon's API in PHP to search for books?
I think this works, but I am having stupid question. I am not able to install and use Zend Service Amazon. I downloaded the software of around 60 MB but, was corrupted.
May be, I actually want some php files to implement it. but, its giving some kind of exe file.
so, here my question is;
Where do I download Zend framework?
How do I install it?
How do I use it?
Thanks in advance
The official download for Zend Framework can be found here. Since you intend to use ZF more as a library than an MVC application framework, you only really need to download the much smaller minimal package.
From looking at the Amazon files you are interested in, I think the list of the following files are all you would need to copy into your application in order to use the Zend Framework Amazon Service APIs (when I use ZF as a library, I always try to only include the actual files I will be using, rather than the whole package, but for starters you can just copy the entire Zend folder to get going):
Zend/Exception.php
Zend/Loader.php
Zend/Loader/Autoloader.php
Zend/Loader/Exception.php
Zend/Uri.php
Zend/Uri/Exception.php
Zend/Service/Abstract.php
Zend/Service/Amazon.php
Zend/Service/Exception.php
Zend/Service/Amazon/Abstract.php
Zend/Service/Amazon/Accessories.php
Zend/Service/Amazon/Authentication.php
Zend/Service/Amazon/CustomerReview.php
Zend/Service/Amazon/EditorialReview.php
Zend/Service/Amazon/Image.php
Zend/Service/Amazon/Item.php
Zend/Service/Amazon/ListmaniaList.php
Zend/Service/Amazon/Offer.php
Zend/Service/Amazon/OfferSet.php
Zend/Service/Amazon/Query.php
Zend/Service/Amazon/ResultSet.php
Zend/Service/Amazon/SimilarProduct.php
Zend/Rest/Client.php
Zend/Rest/Client/Result.php
Zend/Rest/Client/Result/Exception.php
Zend/Crypt.php
Zend/Crypt/Exception.php
Zend/Crypt/Hmac.php
Zend/Crypt/Hmac/Exception.php
If I missed any, forgive me; you should get an exception saying class not found if I left any out, and that should be pretty straightforward to resolve which additional file(s) you need to include.
In order to use Zend Framework I recommending doing the following:
First and foremost, add Zend Framework's files to your PHP include_path. In order to use the ZF files, you need to preserve the directory structure they use, at the very least, you need a Zend folder with all the ZF files in there.
Add to your include path like this:
set_include_path(get_include_path() . PATH_SEPARATOR . '/zf/folder/path');
zf/folder/path should be the path to the folder that the Zend directory is in, but make sure not to actually include the Zend folder in the include path (since Zend does require_once 'Zend/File.php';
Secondly, set up the autoloader if possible. If you decide to use the Zend Framework autoloader, you won't have to manually 'require_once' many of the ZF files.
To set up their autoloader, all you have to do is get an instance of it:
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
You don't need to save or do anything with $autoloader. Just that call is enough to register the Zend autoloader. Since the ZF files are in your path, it will automatically know how to load and locate all ZF files.
After you perform those steps, you are able to use the Amazon services via Zend Framework in your PHP application.
As for the details of using that, hopefully you can find all the details and help you need here, Zend_Service_Amazon Reference Guide. The reference guide should be your best bet, but you can always find the phpDocumentor class documentation here.
Hope that helps! Feel free to ask if you need clarification on anything.
Hi I am really struggling with this one.
I am developing with Google Analytics and Google Adwords; and I am using two separate Oauth libraries in the API Helper Libraries that are written by Google. One is an extension (oauth.so) for Adwords and the other is just a PHP class for Analytics.
When I alter my php.ini file to load the extension, my Analytics OAuth breaks. I think it maybe a conflict of the class names? I have tried changing the name, but haven't had any luck. I had thought that I came up with a solution: Using the dl() function to dynamically load the oauth.so extension on just the Adwords related pages (they are separate scripts):
dl('oauth.so');
Which works great on the command line! But it doesn't work in the browser. I refuse to believe that nobody has come across this issue before. I know that loading the extension from php.ini works in the browser, it just disables the Analytics class. Any one with experience with this, I'd love to hear your input, if you have any suggestions please feel free!
Thank you
The AdWords API PHP client library has been updated to allow for different OAuth libraries:
http://code.google.com/p/google-api-adwords-php/source/detail?r=178
You could even write your own OAuthHandler class that utilized the existing OAuth library that the Analytics library uses.
It's been removed from some SAPI's, either switch to CGI for the webserver (brr), or try to fix the problem with your Analytics PHP class.
I want to include Google Cloud in one of my webprojects which is based on Codeiginiter.
Now my big question is, how to implement the Google API PHP client into CI?
Since CI is a MVC framework it wouldn't make sense including it directly with require_once in the view, so I thought about creating a library but that means a lot of work.
Does anyone know a better solution or maybe a fitting CI library?
Thanks.
This can be implemented by creating a simple library by extending the Google_Api
some thing like..
require_once /path/to/Google_Api/file_name.php
Class my_google_api extend Google_Api
{
// constructor
}
Now load this library to your controller and the access all the methods from Google_api
You can use composer. CI supports autoloading of third party libraries with composer. Besides, usage of composer is a preferred method to install Google APIs Client Library. In this way you won't need to include the library with require_once, all the modules will be loaded automaticly by composer's autoloader.