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';
Related
I'm working on a project , the problem is that some part of the project is made in laravel and some part in core php . Now i want to perform authentication through Auth Facade for my project . Some files are being accessed through routes and some files which are in core php are being accessed directly . so the files which are being accessed through routes Auth is working perfect But what to do for core php files , i don't want to use $_SESSION. Please suggest me a way to use Auth in my core php files.
You can include autoload.php in your core files and then you can try to get laravel functions as we do in WordPress codex.
I am using an third party plugin to enable payment function in my laravel project. But third party only support php. Even they have provided some sample project to show how it worked in php but I have to put those files which includes functions in somewhere in my laravel project and also give them a namespace in the beginning of the file. After I define namespace for phpqrcode.php file, QRcode class still couldn't been found.
Here is the the url where system will need to access QRcode class.
I have put external php in libraries folder:
Here is the file which contains QRcode class and other classes.
I have PHP example on how to use Yelp Fusion API. It uses OAuth.php file with several classes. In main example it is imported with
require_once('lib/OAuth.php');
Can I do the same in Laravel?
Or I'd better provide namespace for OAuth.php file and put it somewhere on the tree? Where to put it?
I suggest your to make a new directory inside app and call it like "Classes" and store your OAuth.php as "/app/Classes/OAuth.php".
Don't forget to put a namespace App\Classes; to top of this file.
Due to having several classes inside your file I suggest to rewrite this a bit and separate each class to file
You can use the Yelp Fusion API with any OAuth implementation. To simplify the process and maintain a clean project, you can use an OAuth package.
You can find a list of OAuth packages for composer here.
Using packages instead of custom PHP files would help to keep project clean.
If you do need to add any custom PHP files, it's recommended to create a directory within the /app directory for organization. A good directory name could be "Libraries" or "Helpers," depending on the type of content being stored.
Note that directories and files within the /app directory are automatically loaded by Composer.
I am working with an existing controller in symfony and need to use an api that I have in my vendors directory. Needless to say I am entering a pre-existent, large scale project and with minimum experience in symfony I am not too sure of how to use the vendor directory. When I have tried using "use vendor\fullcontact\sdk*********;" symfony tells me that there is no class called this in my bundle. I have looked for information on using the vendor directory but have came up dry. Any information regarding how I can start using my vendor directory would be appreciated.
Seems you are using the PHP Library for FullContact API.
This library don't use namespace so you can simply try to use it adding an initial slash to the class when you are using it. As Example:
$this->name = new \Services_FullContact_Name($apikey);
Hope this help
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.