Laravel 4, Composer and hybridauth - How to load additional providers - laravel

I'm using Laravel 4 and have loaded hybridauth via composer and got it working just fine with Facebook and Twitter. Now i'm trying to get it working with Steam, which is listed as an additional provider, however I keep getting the following error:
require_once(vendor/hybridauth/hybridauth/hybridauth/Hybrid/Providers/Steam.php) [function.require-once]: failed to open stream: No such file or directory
Clearly it's looking in the wrong place, the actual class resides in this location:
vendor/hybridauth/hybridauth/additional-providers/hybridauth-steam/Providers/Steam.php
There's very little documentation that I can find on this, my only guess is that the author of hybridauth only offered these additional providers as optional extras and expects you to move the location of the class to the proper place, however with composer this isn't the way to do things and will cause problems anytime I run composer update.
I can't find anyone having a similar problem via Google, which seems strange so i'm worried i'm missing obvious. Is there a way to use the additional providers, to have them autoload, while using hybridauth with Composer?
The only solution I can think to do is to manually include the correct file before it tries to autoload. I don't mind doing that, but i'm assuming there must be a proper way to do this otherwise using Composer with Hybridauth is fairly useless.

I had this problem with Instagram and was able to use the wrapper syntax, which is documented here http://hybridauth.sourceforge.net/userguide/tuts/specific-provider-wrapper.html
The code below got the Instagram adapter working for me.
"Instagram" => array (
"enabled" => true,
"keys" => array (
"id" => xxxx,
"secret" => xxxx,
),
"wrapper" => array(
'class'=>'Hybrid_Providers_Instagram',
'path' => $_SERVER['DOCUMENT_ROOT'].'/../vendor/hybridauth/hybridauth/additional-providers/hybridauth-instagram/Providers/Instagram.php'
)
),
If you read the source at hybridauth/Hybrid/Provider_Adapter.php line 69, you'll see it checks for this before doing require_once with the standard path.

I searched and searched for this as well. All I can think of is that it was made for use without frameworks, then was ported to be used with Composer, however the "additional providers" folder isn't loaded, or something. It kinda sucks.
I just copied the file into the other directory, and everything works now.
This maybe handy for you...
http://blog.elliothesp.co.uk/coding/laravel-4-and-hybrid-auth/
Part regarding this:
Copy the Steam.php file, located at:
laravel/vendor/hybridauth/hybridauth/additional-providers/hybridauth-steam/Providers/Steam.php
Over to:
laravel/vendor/hybridauth/hybridauth/hybridauth/Hybrid/Providers/
I've no idea why the library has them separated, doesn't make any sense to me.

Related

Did I solve my "Target class [mail.manager] does not exist." issue?

Just upgraded from Laravel 6 to 7, and had the error response above when submitting a contact form. I eventually found a solution that seems to work and I am submitting here to help out the next guy.
In the terminal run:
composer require illuminate/mail
Add the following to the top of the controller file (app/Http/Controllers/Main.php in my case):
use \Illuminate\Support\Facades\Mail;
Add this to bootstrap/app.php:
$app->register(Illuminate\Mail\MailServiceProvider::class);
Save and test, and it worked localhost.
If the above does not work for you, there are some other possible issues and solutions available at this link, where I must give credit to vipindasks.
https://laracasts.com/discuss/channels/lumen/lumen-52-mail-not-working
Since I am suppose to ask a question:
Do you see any problems with this solution even though the site and mailer is working now?
You are simply missing a backslash. This tells the autoloader that the file you are looking for is not in the namespace your controller resides in :
$app->register(\Illuminate\Mail\MailServiceProvider::class);
Run composer update hope this will help you

Class 'ConsoleTVs\Charts\ChartsServiceProvider' not found

I want to put a pie chart on my laravel project and install a library consoleTvs. But I decided to remove it from composer since I use a jquery instead.
When i try to run my project I use to have a error message
Class 'ConsoleTVs\Charts\ChartsServiceProvider' not found.
Without seeing ANY code it's very hard to help you.
I try to guess: you are not importing ChartsServiceProvider class so, still guessing, you can put at the start of your file
use App\Providers\ChartsServiceProvider;
So now you want to remove a library from composer.
i hope you remove it correctly. still you can follow below how to remove.
so remove that library code into your composer.json. and hit composer update.
so Hope you remove it correctly, so after removal you facing error of provider.
I guess on the time of installing you manually add a provider into your app.php file inside config folder.
So if, Am right, just go to your app.php file inside config folder and remove that provider as well as its alias too if you give it before.

Laravel 5.1 package to Log all events installation: missing log file and nothing written

I'm trying to use a laravel-request-logger.
I followed the installation steps and set the log level to debug.
Then changed the log level to debug
Ran composer update and composer dump-autoload
Tried several good and bad requests
First I didn't even find the file mentioned http.log anywhere in my app folder, neither in my storage folder (where the only logs folder is).
So I created the http.log file myself within the storage\logs folder and gave all users write permissions. But nothing is written after several good and bad requests.
Second, I notice the default laravel.log hasn't logged anything since installing this package, probably because this package overules the default?
Because Laravel’s logging features are managed by Monolog53, you have a wide array of additional logging options at your disposal, including the ability to write log messages to this log file, set logging levels, send log output to the Firebug console54 via FirePHP55, to the Chrome console56 using Chrome Logger57, or even trigger alerts via e-mail, HipChat58 or Slack59.
public function index(){
$items = [
'one',
'two'
];
\Log::debug($items);
return view('about');
}
Aa customized log message similar to the following will
be appended to storage/logs/laravel.log:
[2015-12-14 01:51:56] local.DEBUG:
array ( 0 => 'Pack luggage',
'one',
'two'
)
There is of course more but it will be to difficult to explain it in here. :) Cheers

Doctrine 2.2 Bisna CLI

I can't get the Bisna doctrine cli to work. It complains about not being able to find the Symfony Console application. Notice it's trying to look for it in a nested directory of Doctrine/Symfony/Console/Symfony/Component/Console. Anybody ever seen this?
PHP Warning: require(/Users/jhicks/workspace/production/application/../library/Doctrine/Symfony/Console/Symfony/Component/Console/Application.php): failed to open stream: No such file or directory in /Users/jhicks/workspace/production/library/Doctrine/Common/ClassLoader.php on line 163
PHP Fatal error: require(): Failed opening required '/Users/jhicks/workspace/production/application/../library/Doctrine/Symfony/Console/Symfony/Component/Console/Application.php' (include_path='/Users/jhicks/workspace/production/library:.:/opt/local/lib/php') in /Users/jhicks/workspace/production/library/Doctrine/Common/ClassLoader.php on line 163
Here's the Github page for the doctrine cli from Bisna: https://github.com/guilhermeblanco/ZendFramework1-Doctrine2/blob/master/bin/doctrine.php
There are many repositories that call themsemves Bisna in Github, it is difficult to find what of them you are using without further information.
The original one is the one created by Guilherme Blanco (Bisna used to be his nickname) called Zend Framework 1 + Doctrine 2 and works like a charm, but it does not bundle the Symfony components necessary to run the CLI tool.
What you have to do is download them from GitHub (search for "Symfony" and you will find the components inside the Organization repository) and put them inside your project's library folder paying attention to the PSR #0 naming conventions.
If you provide the piece of code that generates this error and the repository and version you are using, it will be easier to detect the error and give a better answer. It is naive to try and guess the type of error, but probably you have problems with namespaces and/or how you are calling Symfony's Console component.
If you need some guidance on how this integration can be achieved, you can look at doctrine.php inside Blanco's repository.
Looks like I needed to add these two lines to my existing autoloader bootstrap method:
$symfonyAutoloader = new \Doctrine\Common\ClassLoader('Symfony', 'Doctrine');
$autoloader->pushAutoloader(array($symfonyAutoloader, 'loadClass'), 'Symfony');
I didn't think this would be necessary since I included Symfony in the autoloaderNamespaces array in my application.ini file.
autoloaderNamespaces[] = "Symfony"

codeigniter modular extensions

I'm trying to implement modular extensions into a codeigniter 2 setup but am having a few problems. I followed the installation instructions on the wiki and everything was working fine. Then I started to play around a bit and try and use it. All I did was create a new module called users with the required folders and added a model class called users_m. I then tried to load this from my welcome module controller. According to the wiki this should be very straightforward. I simply added this line
$this->load->model('users/users_m');
to the constructor of my welcome controller.
Unfortunately at this point I get the white screen of death.
So I tried something else. This time I removed the load model line and added
$this->output->enable_profiler(TRUE);
This time I got the welcome page displayed and I got the profiler, but at the top of the page I got this error:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI::$profiler
Filename: MX/Loader.php
Line Number: 145
I don't know if these two tries are related or not, but there's obviously something not right with my setup. Could someone point me in the right direction?
If you accessing the model from the controller in the same module, you can load it using just:
$this->load->model(‘user_m’);
You only have to do $this->load->model(‘module/model_name’); when your cross loading between modules.
Just to make sure, your model is located here right?
application/modules/users/models/users_m.php
As for the profiler error:
1) Have you done installation step 5 and put the Modular Extensions core files into application/core?
2) Do you have the latest version of HMVC? There have been updates to mx/loader.php in the last couple days.
Ps. great tutorial on HMVC: http://net.tutsplus.com/tutorials/php/hvmc-an-introduction-and-application/
if you have folder structure like:
application/
modules/
users/
models/
users_m.php
then use this to call modelsin you controller
$this->load->model('users/users_m','',TRUE);

Resources