I created an project (let's just call it "myproject") which make use of Guzzle 7.0 itself, and should also use another project called "keycloak-admin-client". I tried to use it this way:
require('/opt/myproject/inc/guzzle7.0/vendor/autoload.php');
require('/opt/myproject/inc/keycloak-admin-client/vendor/autoload.php');
use GuzzleHttp\Client;
...
I can use my own HTTP-Requests with Guzzle 7 included, but in the moment i try to use the Keycloak client i get this errormessage:
PHP Fatal error: Uncaught Error: Call to undefined method GuzzleHttp\Psr7\Uri::resolve() in /op/myproject/inc/keycloak-admin-client/vendor/guzzlehttp/guzzle-services/src/Serializer.php:161
So maybe it's not allowed/possible to use Guzzle two times this way? Or is it the mix of versions? (Keycloak Client uses Guzzle 6.0).
Related
I have a php class that is using Client from Guzzle 6 and composer but when I try to load my page I get an error saying: PHP Fatal error: Interface 'GuzzleHttp\ClientInterface' not found even though I am importing the correct class. When I ctrl click the use statement it takes me directly to the ClientInterface.php in Guzzle. I am unsure why I am getting the PHP error. Any ideas? I tried importing and including, neither works.
Method 1:
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
Method 2:
require_once 'vendor/guzzlehttp/guzzle/src/Client.php';
require_once 'vendor/guzzlehttp/guzzle/src/ClientInterface.php';
Whenever I try to run composer update I now receive an error with a root cause of the following
Call to undefined method Illuminate\Bus\Dispatcher::mapUsing()
I can confirm Laravel 5.2 is properly installed, as are all other dependencies. This only happens when php artisan clear-compiled is run.
I've also updated my base controller based on a suggestion from a few hours ago in the Laracasts forum
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
abstract class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}
But I still receive the error
UPDATE: This happens whenever the application is bootstrapped at all. My app won't even run now.
UPDATE 2, full stack trace:
PHP Fatal error: Call to undefined method Illuminate\Bus\Dispatcher::mapUsing() in /Users/Zara/Web/cafe/app/Providers/BusServiceProvider.php on line 16
PHP Stack trace:
PHP 1. {main}() /Users/Zara/Web/cafe/artisan:0
PHP 2. Illuminate\Foundation\Console\Kernel->handle() /Users/Zara/Web/cafe/artisan:36
PHP 3. Illuminate\Foundation\Console\Kernel->bootstrap() /Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:105
PHP 4. Illuminate\Foundation\Application->bootstrapWith() /Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:208
PHP 5. Illuminate\Foundation\Bootstrap\BootProviders->bootstrap() /Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:203
PHP 6. Illuminate\Foundation\Application->boot() /Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php:17
PHP 7. array_walk() /Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
PHP 8. Illuminate\Foundation\Application->Illuminate\Foundation\{closure}() /Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
PHP 9. Illuminate\Foundation\Application->bootProvider() /Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:717
PHP 10. Illuminate\Container\Container->call() /Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:734
PHP 11. call_user_func_array:{/Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Container/Container.php:507}() /Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
PHP 12. Cafe\Providers\BusServiceProvider->boot() /Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Illuminate\Bus\Dispatcher::mapUsing()
From the Laravel 5.2 Upgrade Guide
Separate Commands & Handlers
The Laravel 5.2 command bus now only supports self-handling commands and no longer supports separate commands and handlers.
If you would like to continue using separate commands and handlers, you may install a Laravel Collective package which provides backwards-compatible support for this: https://github.com/LaravelCollective/bus
There is no longer support for non self handling commands which is what the mapper would be for; mapping commands to handlers.
Check Service Providers
Check any service providers you have registered to make sure they aren't calling that method on dispatcher. If still having that issue, you can try checking any package service providers to make sure they aren't calling that method.
I am migrating a Laravel 4.2 application to Laravel 5.1.
During bootstrap, when loading the mail configuration file (config/mail.php), I want to read my SMTP configuration from DB and cache it.
In order to do that I use an Eloquent model class, in which I use the Cache facade's remember() function to get the data I need.
It used to work in 4.2, but after switching to 5.1, I get the following error message:
Call to a member function remember() on a non-object
This happens after I put the following line at the top of the class:
use Illuminate\Support\Facades\Cache;
Without that line I got a Class 'Cache' not found error message.
Any idea what am I missing? Is this even possible in 5.1?
Thanks a lot!
I want to run Guzzle on Xampp server, but when I try to run it, I get message:
Fatal error: Class 'Guzzle\Http\Exception\BadResponseException' not found in D:\2 Workspace\5 Aptana\OpenTok\Guzzle\Http\Exception\ClientErrorResponseException.php on line 8
I need it as a part of PHP API for OpenTok project. I can't use composer, so I downloaded it manually, but it doesn't work. I think it can be something with namespace and use.
What should I do to get this working?
I've tried testing my commands in Laravel 4, as they are significant part of my system, but it seems like the documentation coverage is so poor, that they only explain basic testing of controllers and some models.
In Commands, you can pass arguments via command line to the class and it's received via $this->input property, something I don't know how to emulate.
Whenever I try to run the test for my command, when it expects an argument in "fire" method, I get this error:
Fatal error: Call to a member function getArgument() on a non-object in /var/www/html/project/vendor/laravel/framework/src/Illuminate/Console/Command.php on line 153
Which is logical, there's no argument passed. Is there a way to test this functionality?...
Thanks
Most of it can be done using Symfony Command Tester (since Command is based on Symfony Console), example: http://alexandre-salome.fr/blog/Test-your-commands-in-Symfony2. However this would start to fail if you have to call another artisan command such as $this->call('db:seed'); or etc because this is actually Illuminate\Console\Application specific syntax.
I'm all open if there anyone that have a solution for above scenario.
I have recently made a post about Testing Laravel commands.
If you have a specific part of code that you want to use in multiple commands then you have to move that part of the code somewhere where both commands can use it (Event handler, trait, another class ...) and then in your command reference that code instead of using $this->call('db:seed');