Laravel Class 'Intervention\Image\ImageServiceProvider' not found - php

this question is asked many times and I did all the introductions I could found but I still get this error message.
I updated my config/app.php (
providers:
Intervention\Image\ImageServiceProvider::class,
aliases:
'Image' => Intervention\Image\Facades\Image::class,
and the composer.json
"intervention/image": "dev-master",
After this I did a composer update but my error message is still the same.. I'm using laravel 5
I did what the link says:
http://image.intervention.io/getting_started/installation
and yeah.. now I'm stuck
Another thing I dont understand is why they say I should write:
'Intervention\Image\ImageServiceProvider'
in the provider array. Why the ' '? All the other elements in my provider array are written like this:
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
so I removed the ' ' and addet ::class
the same with the aliases
I dont know if thats okay but maybe someone of you could help me
thanks for help

The ::class operator gives the fully qualified class name and was introduced in PHP 5.5 as you can see here. It's perfectly ok to use it if you have PHP >= 5.5.
I would suggest to check in the vendor directory if the package exists. I use "intervention/image": "^2.3" and everything's working great on L5.1

Related

Yii2 Class yii\authclient\clients\GoogleOAuth does not exist

I use dektrium/yii2-user (on one project) and yiisoft/yii2-authclient (on another one) to login via Google account.
Some time ago it was everything ok, but i guess after last composer update something was changed and now i get an error: "Class yii\authclient\clients\GoogleOAuth does not exist" when try to open login page.
Does anybody has the same issue or know what's wrong?
Thank you
yii2-authclient has been modified in the latest version which is not backward compatible.
Read about the upgrade process here.
Two solutions:
Modify composer.json to fetch 2.0.6 version (replace * with 2.0.6) - no other changes are needed but no more updates for this extension.
Upgrade your code following the guide in the link above so you can be up-to-date.
In the config file
Replace from
'google' => [
'class' => 'yii\authclient\clients\GoogleOAuth',
..
],
Replace to
'google' => [
'class' => 'yii\authclient\clients\Google',
...
],
Use yii\authclient\clients\Google instead of yii\authclient\clients\GoogleOAuth in your config file.

Use a vendor class from composer in Laravel

How would I go around using this class/library in Laravel:
https://github.com/planetteamspeak/ts3phpframework
I tried to include it in config/app.php providers like this:
planetteamspeak\ts3-php-framework\libraries\TeamSpeak3.php::class,
But I keep getting this error, and I couldn't find anything about it that helped me. I also tried to add it without .php at the end but that doesn't help either.
Fatal error: Uncaught ReflectionException: Class log does not exist in PATH-HERE\vendor\laravel\framework\src\Illuminate\Container\Container.php:734
I'll appreciate any help, thanks!
To use your class/library in Laravel, first you should put in your composer.json dependecy for that ts3phpframework
"require": {
"planetteamspeak/ts3phpframework" : "1.*"
}
Inside file app.php you need to do 2 things (something like this, dunno the proper name of alias and provider (be sure to do composer update before doing it)
First add provider (just a hint how to do it)
'providers' => [
ts3phpframework/ts3phpframeworkProvider::class
]
Second add alias (just a hint how to do it)
'aliases' => [
'ts3phpframework' => ts3phpframework\Facades\ts3phpframework::class,
]
If you won't be able to get this library with composer, then add it manually with a help of this. If you won't be able to find alias and provider, then create them manually with a help of this.
And at the end, very similar question already answered here

Integrating Laravel 5.2.* with firebase (Already tried j42)

I am facing the errors while using J42,
This is the composer.json I am using for the require element
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"laravelcollective/html": "^5.2"
I need to add firebase to my application, it is really important .
If anyone can provide me with the step by step installation along with an example it would be really great.
I have tried all sorts of possibilites
'Firebase' => J42\LaravelFirebase\LaravelFirebaseFacade::class
// `'Firebase' => J42\LaravelFirebase\LaravelFirebaseFacade
::class
even adding this class also seems an error since J42/laravel-firebase haven't mentioned it but nothing works without it.
I have already added J42/Laravel... to my composer.json but it also don't work, shows error App/Http/Controller/Firebase class not found
So if anyone could please help me in this issue, then it would be really great.
Thanks
Add the following line to your composer.json and run composer update:
{
"require": {
"j42/laravel-firebase": "dev-master"
}
}
Then add the service providers and facades to config/app.php
'J42\LaravelFirebase\LaravelFirebaseServiceProvider',
'Firebase' => 'J42\LaravelFirebase\LaravelFirebaseFacade'
Finally, you should configure your firebase connection in the config/database.php array.
Simple Access Token
'firebase' => array(
'host' => 'https://<you>.firebaseio.com/',
'token' => '<yoursecret>',
'timeout' => 10,
'sync' => false, // OPTIONAL: auto-sync all Eloquent models with Firebase?
)

Error after adding HTML and Forms in Laravel [duplicate]

This question already has answers here:
FatalErrorException in HtmlServiceProvider.php line 36: laravel
(5 answers)
Closed 6 years ago.
Inside config/app.php file, I added the service provider to the list:
'Illuminate\Html\HtmlServiceProvider',
And added the aliases:
'Form' => 'Illuminate\Html\FormFacade',
'Html' => 'Illuminate\Html\HtmlFacade',
But I get:
FatalErrorException in HtmlServiceProvider.php line 36: Call to undefined method Illuminate\Foundation\Application::bindShared()
Solution 1
Go to the file Illuminate\Foundation\Application and replace bindShare with singleton. This will solve your problem.
bindShared has been renamed to $app->singleton().
This would change the core files and is nit recommended. But if are just looking for a quick fix, this would help. But I strongly suggest you to follow the second solution.
Solution 2
The main problem is because you are using the package Illuminate/HTML which is no longer mainted. You can use Laravelcollective/HTML instead of this.
First, comment out the references to Illuminate\Html in your config/app.php.
Next, do composer remove illuminate/html.
After that, do composer require laravelcollective/html.
Now uncomment the Illuminate\Html items in your config/app.php file and update references to Collective\Html instead of Illuminate\Html.
I think you should follow below steps to add HTML and FORM classes in laravel 5.
first open composer.JSON file and write following line after "laravel/framework": "5.2.*"
put comma(,) at last
"laravelcollective/html": "5.2.*"
now open command promt and type command "composer update"
It will take some time to upgrade.
after complete upgradation Register the service provider in config/app.php by adding the following value into the providers array:
Collective\Html\HtmlServiceProvider::class,
Register facades by adding these two lines in the aliases array:
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
Hope this will solve your problem.
See this post
htmlserviceprovider

Laravel 5.1: Class html does not exist

I am upgrading from 4.2 directly to 5.1 and run into problems with the Html and Form classes.
I followed the upgrade notes, and did
add "laravelcollective/html": "~5.0" to composer.json
composer update
add Collective\Html\HtmlServiceProvider::class to providers in app.php
add Form' => Collective\Html\FormFacade::class,
Html' => Collective\Html\HtmlFacade::class to aliases in app.php
But my views don't work. I get either Class HTML does not exist when using HTML::router or get Class html does not exist when using link_to_route
I also tried Illuminate\html instead of laravelcollective, I did a composer dump-autoload.
The complete errors:
ErrorException in Container.php line 736: Class html does not exist (View: C:\Dev\www\admin\resources\views\clubs\index.blade.php)
ReflectionException in Container.php line 736: Class html does not exist
What am I missing?
I tried everyone's answers and none of them worked for me for some reason. Ultimately I created a completely new laravel application, copied my code and then it started working, So though solved the actual problem remains a mystery.
Add in composer.json
"illuminate/html": "5.*"
and run composer update
Open your config/app.php
add under 'providers'
Illuminate\Html\HtmlServiceProvider::class,
add under 'aliases'
'Form' => Illuminate\Html\FormFacade::class,
'Html' => Illuminate\Html\HtmlFacade::class,
and under your blade templates, use as such
{!! HTML::style('assets/css/flatten.css') !!}
My solution in my case it was problem with CASE-Sensitive class name.
In my config/app.php (in aliases)
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
I am tried to use in view this code:
{!! HTML::mailto('mailto:example#example.com', 'example#example.com'); !!}
and that was an error:
"FatalErrorException in ccf70b1d0b9930d6c4e8f3859fff448f line 11: Class 'HTML' not found"
Name of class 'HTML' is CASE-Sensitive. You should use 'Html' as in your config (config/app.php) file.
Hope this help for some people.
Please change your blade file from this
{{ HTML::style('css/bootstrap.min.css') }}
to
{{ Html::style('css/bootstrap.min.css') }}
It's working.
A simple restart after composer update worked perfectly for me. I was looking for the answer, and got stuck at the same position. I'd suggest, run config:cache and cache:clear and restart the IDE. It will work.
My problem is solved, but the actual cause is still unknown. I have created a completely new laravel install and copied my source (all of it). The new application worked right away (after installing illuminate/html).
So you think I did something wrong with packages? That's what I thought, and then I did a diff on the two directories, only to find out they were identical. So it's a real mystery.
So, now everything is working, I simply renamed my new application and can continue.
I do know at some point I probably had both the collective and the illuminate versions of the HTML package installed. That's what most likely corrupted everything.
this is right way
If you try to use Form::open() or any of the Form methods in a fresh Laravel 5 install, you would get something like this:
http://laraveldaily.com/class-form-not-found-in-laravel-5/
I think I have found the solution.
In your app.php you have declared
'Form' => Illuminate\Html\FormFacade::class,
'Html' => Illuminate\Html\HtmlFacade::class,
While in your View you have called the same class as
{!! HTML::style('css/bootstrap.min.css') !!}
There is nothing wrong with the packages as the marked answer above but rather difference in capitalization of the word HTML as the previous documentation ver 5.0.*.
It should be
'Form' => Illuminate\Html\FormFacade::class,
'HTML' => Illuminate\Html\HtmlFacade::class,
Try it
php artisan cache:clear
php artisan clear-compiled
edit config/app.php
add this into providers
Collective\Html\HtmlServiceProvider::class,
and this into aliases
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,

Categories