j42 / laravel-firebase

A Firebase port for Laravel (4.2+)
MIT License
51 stars 22 forks source link

Cannot declare class J42\LaravelFirebase\Client because the name is already in use #24

Closed zeusent closed 8 years ago

zeusent commented 8 years ago

When I try to use any of the methods exposed by the Laravel class I get this error:

Whoops, looks like something went wrong.

FatalErrorException in Client.php line 8:
Cannot declare class J42\LaravelFirebase\Client because the name is already in use

1. in Client.php line 8
2. at FatalErrorException->__construct() in HandleExceptions.php line 133
3. at HandleExceptions->fatalExceptionFromError() in HandleExceptions.php line 118
4. at HandleExceptions->handleShutdown() in HandleExceptions.php line 0
5. at Composer\Autoload\includeFile() in ClassLoader.php line 301
6. at ClassLoader->loadClass() in Container.php line 53
7. at spl_autoload_call() in Container.php line 53
8. at LaravelFirebaseServiceProvider->J42\LaravelFirebase\{closure}() in Container.php line 735
9. at Container->build() in Container.php line 633
10. at Container->make() in Application.php line 697
11. at Application->make() in Container.php line 1178
12. at Container->offsetGet() in Facade.php line 151
13. at Facade::resolveFacadeInstance() in Facade.php line 120
14. at Facade::getFacadeRoot() in Facade.php line 207
15. at Facade::__callStatic() in routes.php line 19
16. at LaravelFirebaseFacade::get() in routes.php line 19
17. at RouteServiceProvider->{closure:/usr/share/nginx/html/app/Http/routes.php:16-21}() in Route.php line 158
18. at call_user_func_array:{/usr/share/nginx/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php:158}() in Route.php line 158
19. at Route->runCallable() in Route.php line 137
20. at Route->run() in Router.php line 724
21. at Router->Illuminate\Routing\{closure}() in Pipeline.php line 52
22. at call_user_func:{/usr/share/nginx/html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:52}() in Pipeline.php line 52
23. at Pipeline->Illuminate\Routing\{closure}() in VerifyCsrfToken.php line 64
24. at VerifyCsrfToken->handle() in Pipeline.php line 124
25. at call_user_func_array:{/usr/share/nginx/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124}() in Pipeline.php line 124
26. at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
27. at call_user_func:{/usr/share/nginx/html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:32}() in Pipeline.php line 32
28. at Pipeline->Illuminate\Routing\{closure}() in ShareErrorsFromSession.php line 49
29. at ShareErrorsFromSession->handle() in Pipeline.php line 124
30. at call_user_func_array:{/usr/share/nginx/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124}() in Pipeline.php line 124
31. at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
32. at call_user_func:{/usr/share/nginx/html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:32}() in Pipeline.php line 32
33. at Pipeline->Illuminate\Routing\{closure}() in StartSession.php line 62
34. at StartSession->handle() in Pipeline.php line 124
35. at call_user_func_array:{/usr/share/nginx/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124}() in Pipeline.php line 124
36. at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
37. at call_user_func:{/usr/share/nginx/html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:32}() in Pipeline.php line 32
38. at Pipeline->Illuminate\Routing\{closure}() in AddQueuedCookiesToResponse.php line 37
39. at AddQueuedCookiesToResponse->handle() in Pipeline.php line 124
40. at call_user_func_array:{/usr/share/nginx/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124}() in Pipeline.php line 124
41. at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
42. at call_user_func:{/usr/share/nginx/html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:32}() in Pipeline.php line 32
43. at Pipeline->Illuminate\Routing\{closure}() in EncryptCookies.php line 59
44. at EncryptCookies->handle() in Pipeline.php line 124
45. at call_user_func_array:{/usr/share/nginx/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124}() in Pipeline.php line 124
46. at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
47. at call_user_func:{/usr/share/nginx/html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:32}() in Pipeline.php line 32
48. at Pipeline->Illuminate\Routing\{closure}() in Pipeline.php line 103
49. at call_user_func:{/usr/share/nginx/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103}() in Pipeline.php line 103
50. at Pipeline->then() in Router.php line 726
51. at Router->runRouteWithinStack() in Router.php line 699
52. at Router->dispatchToRoute() in Router.php line 675
53. at Router->dispatch() in Kernel.php line 246
54. at Kernel->Illuminate\Foundation\Http\{closure}() in Pipeline.php line 52
55. at call_user_func:{/usr/share/nginx/html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:52}() in Pipeline.php line 52
56. at Pipeline->Illuminate\Routing\{closure}() in CheckForMaintenanceMode.php line 44
57. at CheckForMaintenanceMode->handle() in Pipeline.php line 124
58. at call_user_func_array:{/usr/share/nginx/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124}() in Pipeline.php line 124
59. at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
60. at call_user_func:{/usr/share/nginx/html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:32}() in Pipeline.php line 32
61. at Pipeline->Illuminate\Routing\{closure}() in Pipeline.php line 103
62. at call_user_func:{/usr/share/nginx/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103}() in Pipeline.php line 103
63. at Pipeline->then() in Kernel.php line 132
64. at Kernel->sendRequestThroughRouter() in Kernel.php line 99
65. at Kernel->handle() in index.php line 54
66. at {main}() in index.php line 0

Any idea what I'm doing wrong?

zeusent commented 8 years ago

Fixed it by changing line 5 of Client.php to

use GuzzleHttp\Client as GClient;

and line 36 to

$this->http = new GClient();

Thanks, Mickey

waqasraza123 commented 8 years ago

@zeusent thanks man for posting the solution